mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-09 20:33:03 +00:00
Merge remote-tracking branch 'origin/maint'
* origin/maint: bump to 2012 in skeletons. build: remove ancient Autoconf tests. doc: c++: complete the location documentation. c++: locations: provide convenience constructors. c++: locations: remove useless "inline". glr: do not use locations when they are not requested c++: use nullptr for C++11. build: simplify and improve the compiler warnings for tests. gnulib: update. maint: formatting changes. NEWS: update. Java: Fix syntax error handling without error token. tests: beware of -pedantic on large #line numbers. tests: when using the C++ compiler, use its flags too. Conflicts: data/glr.c data/glr.cc data/lalr1.cc data/location.cc data/yacc.c tests/Makefile.am
This commit is contained in:
@@ -781,3 +781,69 @@ AT_CHECK([[$EGREP -v ' */?\*' YYParser.java | grep 'Position']], [1], [ignore])
|
||||
AT_CHECK([[$EGREP -v ' */?\*' YYParser.java | grep 'Location']], [1], [ignore])
|
||||
|
||||
AT_CLEANUP
|
||||
|
||||
|
||||
# ----------------------------------------------- #
|
||||
# Java syntax error handling without error token. #
|
||||
# ----------------------------------------------- #
|
||||
|
||||
AT_SETUP([Java syntax error handling without error token])
|
||||
|
||||
AT_DATA([[YYParser.y]], [[%language "Java"
|
||||
|
||||
%lex-param { String s }
|
||||
|
||||
%code imports {
|
||||
import java.io.IOException;
|
||||
}
|
||||
|
||||
%code lexer {
|
||||
String Input;
|
||||
int Position;
|
||||
|
||||
public YYLexer (String s)
|
||||
{
|
||||
Input = s;
|
||||
Position = 0;
|
||||
}
|
||||
|
||||
public void yyerror (String s)
|
||||
{
|
||||
System.err.println (s);
|
||||
}
|
||||
|
||||
public Object getLVal ()
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
public int yylex () throws IOException
|
||||
{
|
||||
if (Position >= Input.length ())
|
||||
return EOF;
|
||||
else
|
||||
return Input.charAt (Position++);
|
||||
}
|
||||
}
|
||||
|
||||
%code {
|
||||
public static void main (String args []) throws IOException
|
||||
{
|
||||
YYParser p = new YYParser (args [0]);
|
||||
p.parse ();
|
||||
}
|
||||
}
|
||||
%%
|
||||
input:
|
||||
'a' 'a'
|
||||
;
|
||||
]])
|
||||
AT_BISON_CHECK([[YYParser.y]])
|
||||
AT_JAVA_COMPILE([[YYParser.java]])
|
||||
AT_JAVA_PARSER_CHECK([[YYParser aa]], [[0]], [[]], [[]])
|
||||
AT_JAVA_PARSER_CHECK([[YYParser ab]], [[0]], [[]], [[syntax error
|
||||
]])
|
||||
AT_JAVA_PARSER_CHECK([[YYParser ba]], [[0]], [[]], [[syntax error
|
||||
]])
|
||||
|
||||
AT_CLEANUP
|
||||
|
||||
Reference in New Issue
Block a user