tests: formatting changes

* tests/javapush.at: here.
This commit is contained in:
Akim Demaille
2019-03-31 18:44:56 +02:00
parent 10175e4a65
commit 0b42cf8a36

View File

@@ -273,8 +273,7 @@ input:
line: line:
'\n' '\n'
| exp '\n' | exp '\n' { System.out.println("total = "+$[]1); }
{System.out.println("total = "+$[]1);}
| error '\n' | error '\n'
; ;
@@ -349,54 +348,52 @@ AT_DATA([Calc.y],[[/* Infix notation calculator--calc */
%define api.parser.class {Calc} %define api.parser.class {Calc}
%code { %code {
static class UserLexer implements Calc.Lexer static class UserLexer implements Calc.Lexer
{
StreamTokenizer st;
StringReader rdr;
public UserLexer(StringReader reader)
{ {
rdr = reader; StreamTokenizer st;
st = new StreamTokenizer(rdr); StringReader rdr;
st.resetSyntax();
st.eolIsSignificant(true);
st.whitespaceChars(9, 9);
st.whitespaceChars(32, 32);
st.wordChars(48, 57);
}
Integer yylval; public UserLexer(StringReader reader)
{
rdr = reader;
st = new StreamTokenizer(rdr);
st.resetSyntax();
st.eolIsSignificant(true);
st.whitespaceChars(9, 9);
st.whitespaceChars(32, 32);
st.wordChars(48, 57);
}
public Object getLVal() { return yylval; } Integer yylval;
public void yyerror(String msg) { System.err.println(msg); } public Object getLVal() { return yylval; }
public int yylex () throws IOException public void yyerror(String msg) { System.err.println(msg); }
{
switch (st.nextToken()) { public int yylex () throws IOException
case StreamTokenizer.TT_EOF: return EOF; {
case StreamTokenizer.TT_EOL: return (int) '\n'; switch (st.nextToken()) {
case StreamTokenizer.TT_WORD: case StreamTokenizer.TT_EOF: return EOF;
yylval = new Integer (st.sval); case StreamTokenizer.TT_EOL: return (int) '\n';
return NUM; case StreamTokenizer.TT_WORD:
default: return st.ttype; yylval = new Integer (st.sval);
return NUM;
default: return st.ttype;
}
} }
} }
} }
}
%code { %code {
public static void main (String[] argv) public static void main (String[] argv)
throws IOException throws IOException
{ {
StringReader reader = getinput(argv[0]); StringReader reader = getinput(argv[0]);
UserLexer lexer = new UserLexer(reader); UserLexer lexer = new UserLexer(reader);
Calc calc = new Calc(lexer); Calc calc = new Calc(lexer);
calc.setDebugLevel(1); calc.setDebugLevel(1);
calc.parse(); calc.parse();
}//main }//main
} }
]AT_CALC_BODY[ ]AT_CALC_BODY[
@@ -676,14 +673,14 @@ AT_DATA([Calc.y],[[/* Infix notation calculator--calc. */
%code { ]AT_JAVA_POSITION_DEFINE[ } %code { ]AT_JAVA_POSITION_DEFINE[ }
%code { %code {
public static void main (String[] argv) public static void main (String[] argv)
throws IOException throws IOException
{ {
StringReader reader = getinput(argv[0]); StringReader reader = getinput(argv[0]);
Calc calc = new Calc(reader); Calc calc = new Calc(reader);
calc.setDebugLevel(1); calc.setDebugLevel(1);
calc.parse(); calc.parse();
} }
} }
]AT_CALC_BODY[ ]AT_CALC_BODY[