mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-18 00:33:03 +00:00
examples: clean up the Java/D examples
* examples/java/Calc.y: Fix indentation. Sort. Don't use %name-prefix, since api.parser.class is already defined. * examples/d/calc.y: Likewise.
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
%language "D"
|
%language "D"
|
||||||
%name-prefix "Calc"
|
|
||||||
%define api.parser.class {Calc}
|
%define api.parser.class {Calc}
|
||||||
%define public
|
%define public
|
||||||
|
|
||||||
|
|||||||
@@ -1,9 +1,19 @@
|
|||||||
%language "Java"
|
%language "Java"
|
||||||
%name-prefix "Calc"
|
|
||||||
%define api.parser.class {Calc}
|
%define api.parser.class {Calc}
|
||||||
%define public
|
%define public
|
||||||
|
|
||||||
%define parse.error verbose %locations
|
%define parse.error verbose
|
||||||
|
%locations
|
||||||
|
|
||||||
|
%code imports {
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.io.InputStream;
|
||||||
|
import java.io.InputStreamReader;
|
||||||
|
import java.io.Reader;
|
||||||
|
import java.io.StreamTokenizer;
|
||||||
|
}
|
||||||
|
|
||||||
%code {
|
%code {
|
||||||
public static void main (String args[]) throws IOException
|
public static void main (String args[]) throws IOException
|
||||||
{
|
{
|
||||||
@@ -13,14 +23,6 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
%code imports {
|
|
||||||
import java.io.StreamTokenizer;
|
|
||||||
import java.io.InputStream;
|
|
||||||
import java.io.InputStreamReader;
|
|
||||||
import java.io.Reader;
|
|
||||||
import java.io.IOException;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Bison Declarations */
|
/* Bison Declarations */
|
||||||
%token <Integer> NUM "number"
|
%token <Integer> NUM "number"
|
||||||
%type <Integer> exp
|
%type <Integer> exp
|
||||||
|
|||||||
Reference in New Issue
Block a user