From 66ac4acc6c0ad4be029507f7ab573edab5a356c4 Mon Sep 17 00:00:00 2001 From: Akim Demaille Date: Sat, 15 Jun 2019 12:14:33 +0200 Subject: java: style changes * data/skeletons/lalr1.java: Use more conventional function names for Java. Prefer < and <= to => and >. Use the same approach for m4 quotation as in the other skeletons. Fix indentation issues. * tests/calc.at, tests/java.at, tests/javapush.at: Fix quotation style. (main): Use 'args', not 'argv', the former seems more conventional and is used elsewhere in Bison. Prefer character literals to integers to denote characters. * examples/java/Calc.y: Likewise. --- tests/java.at | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) (limited to 'tests/java.at') diff --git a/tests/java.at b/tests/java.at index 29797154..0c66c817 100644 --- a/tests/java.at +++ b/tests/java.at @@ -127,17 +127,17 @@ class CalcLexer implements Calc.Lexer { ]])[ StreamTokenizer st; - public ]AT_LEXPARAM_IF([[YYLexer]], [[CalcLexer]]) (InputStream is) + public ]AT_LEXPARAM_IF([[YYLexer]], [[CalcLexer]])[ (InputStream is) { st = new StreamTokenizer (new InputStreamReader (is)); st.resetSyntax (); st.eolIsSignificant (true); - st.whitespaceChars (9, 9); - st.whitespaceChars (32, 32); - st.wordChars (48, 57); + st.whitespaceChars ('\t', '\t'); + st.whitespaceChars (' ', ' '); + st.wordChars ('0', '9'); } -AT_LOCATION_IF([[ +]AT_LOCATION_IF([[ Position yypos = new Position (1, 0); public Position getStartPos() { @@ -157,15 +157,14 @@ AT_LOCATION_IF([[ } public int yylex () throws IOException { - int ttype = st.nextToken (); - ]AT_LOCATION_IF([[yypos = new Position (yypos.lineno (), - yypos.token () + 1);]])[ + int ttype = st.nextToken ();]AT_LOCATION_IF([[ + yypos = new Position (yypos.lineno (), yypos.token () + 1);]])[ if (ttype == st.TT_EOF) return EOF; else if (ttype == st.TT_EOL) - { - ]AT_LOCATION_IF([[yypos = new Position (yypos.lineno () + 1, 0);]])[ + {]AT_LOCATION_IF([[ + yypos = new Position (yypos.lineno () + 1, 0);]])[ return (int) '\n'; } @@ -251,7 +250,7 @@ $2 AT_BISON_CHECK([-Wno-deprecated -o Calc.java Calc.y]) AT_JAVA_COMPILE([Calc.java]) -# Test the priorities. +# Test the precedences. AT_DATA([[input]], [[1 + 2 * 3 = 7 1 + 2 * -3 = -5 -- cgit v1.2.1