)
+ * - commented out package declaration for the example
+ * - original version at http://www.smo.f2s.com/utils/
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * See COPYING.TXT for details.
+ */
+
+// package com.Ostermiller.util;
+
+import java.io.*;
+
+/**
+ * A StraightStreamReader is a bridge from byte streams to character streams: It reads bytes
+ * and translates them into characters without using a character encoding. The characters
+ * that a StraightStreamReader returns may not be valid unicode characters but they are
+ * guaranteed to be in the 0x00 to 0xFF range.
+ *
+ * Most of the time you want to do character encoding translation when translating bytes to
+ * characters. If you are planning on displaying the text, you should always do this and should
+ * use an InputStreamReader for the purpose. Sometimes it is useful to treat characters as bytes
+ * with some extra bits. In these cases you would want to use a StraightStreamReader.
+ *
+ * For top efficiency, consider wrapping an StraightStreamReader within a BufferedReader. For example:
+ * BufferedReader in = new BufferedReader(new StraightStreamReader(System.in));
+ */
+public class StraightStreamReader extends Reader{
+
+ /**
+ * The input stream from which all methods in this class read.
+ */
+ private InputStream in;
+
+ /**
+ * A byte array to be used for calls to the InputStream. This
+ * is cached as a class variable to avoid object creation and
+ * deletion each time a read is called. This buffer may be
+ * null and may not be large enough. Make sure to check it
+ * before using it.
+ */
+ private byte[] buffer;
+
+ /**
+ * Create a StraightStreamReader from an InputStream
+ *
+ * @param in InputStream to wrap a Reader around.
+ */
+ public StraightStreamReader(InputStream in) {
+ this.in = in;
+ }
+
+ /**
+ * Close the stream.
+ *
+ * @throws IOException If an I/O error occurs
+ */
+ public void close() throws IOException {
+ in.close();
+ }
+
+ /**
+ * Mark the present position in the stream. Subsequent calls to reset()
+ * will attempt to reposition the stream to this point. Not all
+ * character-input streams support the mark() operation.
+ *
+ * @param readAheadLimit Limit on the number of characters that may be read
+ * while still preserving the mark. After reading this many characters,
+ * attempting to reset the stream may fail.
+ * @throws IOException If the stream does not support mark(), or if some other I/O error occurs
+ */
+ public void mark(int readAheadLimit) throws IOException {
+ in.mark(readAheadLimit);
+ }
+
+ /**
+ * Tell whether this stream supports the mark() operation.
+ *
+ * @return true if and only if this stream supports the mark operation.
+ */
+ public boolean markSupported(){
+ return in.markSupported();
+ }
+
+ /**
+ * Read a single character. This method will block until a character is available, an
+ * I/O error occurs, or the end of the stream is reached.
+ *
+ * @return The character read, as an integer in the range 0 to 256 (0x00-0xff), or -1 if
+ * the end of the stream has been reached
+ * @throws IOException If an I/O error occurs
+ */
+ public int read() throws IOException {
+ return in.read();
+ }
+
+ /**
+ * Read characters into an array. This method will block until some input is available,
+ * an I/O error occurs, or the end of the stream is reached.
+ *
+ * @param cbuf Destination buffer
+ * @return The number of bytes read, or -1 if the end of the stream has been reached
+ * @throws IOException If an I/O error occurs
+ */
+ public int read(char[] cbuf) throws IOException {
+ return read(cbuf, 0, cbuf.length);
+ }
+
+ /**
+ * Read characters into an array. This method will block until some input is available,
+ * an I/O error occurs, or the end of the stream is reached.
+ *
+ * @param cbuf Destination buffer
+ * @param off Offset at which to start storing characters
+ * @param len Maximum number of characters to read
+ * @return The number of bytes read, or -1 if the end of the stream has been reached
+ * @throws IOException If an I/O error occurs
+ */
+ public int read(char[] cbuf, int off, int len) throws IOException {
+ // ensure the capacity of the buffer that we will be using
+ // to read from the input stream
+ if (buffer == null || buffer.length < len){
+ buffer = new byte[len];
+ }
+ // read from the input stream and copy it to the character array
+ int length = in.read(buffer, 0, len);
+ for (int i=0; i 0);
+ }
+
+ /**
+ * Reset the stream. If the stream has been marked, then attempt to reposition it at the mark.
+ * If the stream has not been marked, then attempt to reset it in some way appropriate to the
+ * particular stream, for example by repositioning it to its starting point. Not all
+ * character-input streams support the reset() operation, and some support reset()
+ * without supporting mark().
+ *
+ * @throws IOException If the stream has not been marked, or if the mark has been invalidated,
+ * or if the stream does not support reset(), or if some other I/O error occurs
+ */
+ public void reset() throws IOException {
+ in.reset();
+ }
+
+ /**
+ * Skip characters. This method will block until some characters are available,
+ * an I/O error occurs, or the end of the stream is reached.
+ *
+ * @param n The number of characters to skip
+ * @return The number of characters actually skipped
+ * @throws IllegalArgumentException If n is negative
+ * @throws IOException If an I/O error occurs
+ */
+ public long skip(long n) throws IOException {
+ return in.skip(n);
+ }
+
+ /**
+ * Regression test for this class. If this class is working, this should
+ * run and print no errors.
+ *
+ * This method creates a tempory file in the working directory called "test.txt".
+ * This file should not exist before hand, and the program should have create,
+ * read, write, and delete access to this file.
+ *
+ * @param args command line arguments (ignored)
+ */
+ private static void main(String[] args){
+ try {
+ File f = new File("test.txt");
+ if (f.exists()){
+ throw new IOException(f + " already exists. I don't want to overwrite it.");
+ }
+ StraightStreamReader in;
+ char[] cbuf = new char[0x1000];
+ int read;
+ int totRead;
+
+ // write a file with all possible values of bytes
+ FileOutputStream out = new FileOutputStream(f);
+ for (int i=0x00; i<0x100; i++){
+ out.write(i);
+ }
+ out.close();
+
+ // read it back using the read single character method
+ in = new StraightStreamReader(new FileInputStream(f));
+ for (int i=0x00; i<0x100; i++){
+ read = in.read();
+ if (read != i){
+ System.err.println("Error: " + i + " read as " + read);
+ }
+ }
+ in.close();
+
+ // read as much of it back as possible with one simple buffer read.
+ in = new StraightStreamReader(new FileInputStream(f));
+ totRead = in.read(cbuf);
+ if (totRead != 0x100){
+ System.err.println("Simple buffered read did not read the full amount: 0x" + Integer.toHexString(totRead));
+ }
+ for (int i=0x00; i 0){
+ totRead += read;
+ }
+ if (totRead != 0x100){
+ System.err.println("Not enough read. Bytes read: " + Integer.toHexString(totRead));
+ }
+ for (int i=0x00; i 0){
+ totRead += read;
+ }
+ if (totRead != 0x100){
+ System.err.println("Not enough read. Bytes read: " + Integer.toHexString(totRead));
+ }
+ for (int i=0x00; i 0){
+ totRead += read;
+ }
+ if (totRead != 0x100){
+ System.err.println("Not enough read. Bytes read: " + Integer.toHexString(totRead));
+ }
+ for (int i=0x00; i *
+ * All rights reserved. *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License. See the file *
+ * COPYRIGHT for more information. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License along *
+ * with this program; if not, write to the Free Software Foundation, Inc., *
+ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *
+ * *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+
+import java.io.*;
+
+%%
+
+%class BinaryLexer
+%8bit
+
+%int
+
+%{
+ public static void main(String [] argv) {
+ for (int i = 0; i < argv.length; i++) {
+ try {
+ System.out.print("["+argv[i]+"] is ");
+ BinaryLexer l = new BinaryLexer(new StraightStreamReader(new FileInputStream(argv[i])));
+ l.yylex();
+ }
+ catch (Exception e) {
+ e.printStackTrace(System.out);
+ System.exit(1);
+ }
+ }
+ }
+%}
+
+magic = \xCA \xFE \xBA \xBE
+
+%%
+
+{magic} [^]+ { System.out.println("a class file"); }
+
+[^]+ { System.out.println("not a class file"); }
Index: /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/examples/byaccj/Makefile
===================================================================
--- /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/examples/byaccj/Makefile (revision 25585)
+++ /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/examples/byaccj/Makefile (revision 25585)
@@ -0,0 +1,27 @@
+# only works with the Java extension of yacc:
+# byacc/j from http://troi.lincom-asg.com/~rjamison/byacc/
+
+JFLEX = jflex
+BYACCJ = yacc -J
+JAVAC = javac
+
+# targets:
+
+all: Parser.class
+
+run: Parser.class
+ java Parser
+
+build: clean Parser.class
+
+clean:
+ rm -f *~ *.class *.java
+
+Parser.class: Yylex.java Parser.java
+ $(JAVAC) Parser.java
+
+Yylex.java: calc.flex
+ $(JFLEX) calc.flex
+
+Parser.java: calc.y
+ $(BYACCJ) calc.y
Index: /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/examples/byaccj/README
===================================================================
--- /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/examples/byaccj/README (revision 25585)
+++ /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/examples/byaccj/README (revision 25585)
@@ -0,0 +1,22 @@
+This directory contains an interoperability example for BYacc/J and JFlex
+(a small calculator)
+
+You need the parser generator byacc/j from
+http://troi.lincom-asg.com/~rjamison/byacc/
+for this example to work (version byacc/j 1.1 has been tested).
+
+Use the Makefile to generate the lexer and parser.
+The example can then be started with
+
+java Parser
+
+
+files:
+
+calc.flex
+ JFlex specification for the lexical part of the arithmetic expressions
+
+calc.y
+ BYacc/J specification and main program for the calculator
+
+
Index: /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/examples/byaccj/calc.flex
===================================================================
--- /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/examples/byaccj/calc.flex (revision 25585)
+++ /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/examples/byaccj/calc.flex (revision 25585)
@@ -0,0 +1,62 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright (C) 2000 Gerwin Klein *
+ * All rights reserved. *
+ * *
+ * Thanks to Larry Bell and Bob Jamison for suggestions and comments. *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License. See the file *
+ * COPYRIGHT for more information. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License along *
+ * with this program; if not, write to the Free Software Foundation, Inc., *
+ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *
+ * *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+%%
+
+%byaccj
+
+%{
+ private Parser yyparser;
+
+ public Yylex(java.io.Reader r, Parser yyparser) {
+ this(r);
+ this.yyparser = yyparser;
+ }
+%}
+
+NUM = [0-9]+ ("." [0-9]+)?
+NL = \n | \r | \r\n
+
+%%
+
+/* operators */
+"+" |
+"-" |
+"*" |
+"/" |
+"^" |
+"(" |
+")" { return (int) yycharat(0); }
+
+/* newline */
+{NL} { return Parser.NL; }
+
+/* float */
+{NUM} { yyparser.yylval = new ParserVal(Double.parseDouble(yytext()));
+ return Parser.NUM; }
+
+/* whitespace */
+[ \t]+ { }
+
+\b { System.err.println("Sorry, backspace doesn't work"); }
+
+/* error fallback */
+[^] { System.err.println("Error: unexpected character '"+yytext()+"'"); return -1; }
Index: /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/examples/byaccj/calc.y
===================================================================
--- /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/examples/byaccj/calc.y (revision 25585)
+++ /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/examples/byaccj/calc.y (revision 25585)
@@ -0,0 +1,112 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright (C) 2001 Gerwin Klein *
+ * All rights reserved. *
+ * *
+ * This is a modified version of the example from *
+ * http://www.lincom-asg.com/~rjamison/byacc/ *
+ * *
+ * Thanks to Larry Bell and Bob Jamison for suggestions and comments. *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License. See the file *
+ * COPYRIGHT for more information. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License along *
+ * with this program; if not, write to the Free Software Foundation, Inc., *
+ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *
+ * *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+%{
+ import java.io.*;
+%}
+
+%token NL /* newline */
+%token NUM /* a number */
+
+%type exp
+
+%left '-' '+'
+%left '*' '/'
+%left NEG /* negation--unary minus */
+%right '^' /* exponentiation */
+
+%%
+
+input: /* empty string */
+ | input line
+ ;
+
+line: NL { if (interactive) System.out.print("Expression: "); }
+ | exp NL { System.out.println(" = " + $1);
+ if (interactive) System.out.print("Expression: "); }
+ ;
+
+exp: NUM { $$ = $1; }
+ | exp '+' exp { $$ = $1 + $3; }
+ | exp '-' exp { $$ = $1 - $3; }
+ | exp '*' exp { $$ = $1 * $3; }
+ | exp '/' exp { $$ = $1 / $3; }
+ | '-' exp %prec NEG { $$ = -$2; }
+ | exp '^' exp { $$ = Math.pow($1, $3); }
+ | '(' exp ')' { $$ = $2; }
+ ;
+
+%%
+
+ private Yylex lexer;
+
+
+ private int yylex () {
+ int yyl_return = -1;
+ try {
+ yylval = new ParserVal(0);
+ yyl_return = lexer.yylex();
+ }
+ catch (IOException e) {
+ System.err.println("IO error :"+e);
+ }
+ return yyl_return;
+ }
+
+
+ public void yyerror (String error) {
+ System.err.println ("Error: " + error);
+ }
+
+
+ public Parser(Reader r) {
+ lexer = new Yylex(r, this);
+ }
+
+
+ static boolean interactive;
+
+ public static void main(String args[]) throws IOException {
+ System.out.println("BYACC/Java with JFlex Calculator Demo");
+
+ Parser yyparser;
+ if ( args.length > 0 ) {
+ // parse a file
+ yyparser = new Parser(new FileReader(args[0]));
+ }
+ else {
+ // interactive mode
+ System.out.println("[Quit with CTRL-D]");
+ System.out.print("Expression: ");
+ interactive = true;
+ yyparser = new Parser(new InputStreamReader(System.in));
+ }
+
+ yyparser.yyparse();
+
+ if (interactive) {
+ System.out.println();
+ System.out.println("Have a nice day");
+ }
+ }
Index: /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/examples/cup/Main.java
===================================================================
--- /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/examples/cup/Main.java (revision 25585)
+++ /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/examples/cup/Main.java (revision 25585)
@@ -0,0 +1,39 @@
+/*
+ This example comes from a short article series in the Linux
+ Gazette by Richard A. Sevenich and Christopher Lopes, titled
+ "Compiler Construction Tools". The article series starts at
+
+ http://www.linuxgazette.com/issue39/sevenich.html
+
+ Small changes and updates to newest JFlex+Cup versions
+ by Gerwin Klein
+*/
+
+/*
+ Commented By: Christopher Lopes
+ File Name: Main.java
+ To Create:
+ After the scanner, lcalc.flex, and the parser, ycalc.cup, have been created.
+ > javac Main.java
+
+ To Run:
+ > java Main test.txt
+ where test.txt is an test input file for the calculator.
+*/
+
+import java.io.*;
+
+public class Main {
+ static public void main(String argv[]) {
+ /* Start the parser */
+ try {
+ parser p = new parser(new Lexer(new FileReader(argv[0])));
+ Object result = p.parse().value;
+ } catch (Exception e) {
+ /* do cleanup here -- possibly rethrow e */
+ e.printStackTrace();
+ }
+ }
+}
+
+
Index: /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/examples/cup/Makefile
===================================================================
--- /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/examples/cup/Makefile (revision 25585)
+++ /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/examples/cup/Makefile (revision 25585)
@@ -0,0 +1,26 @@
+JAVA=java
+JAVAC=javac
+JFLEX=jflex
+CUP=$(JAVA) java_cup.Main <
+
+all: test
+
+test: output.txt
+ @(diff output.txt output.good && echo "Test OK!") || echo "Test failed!"
+
+output.txt: Main.class test.txt
+ $(JAVA) Main test.txt > output.txt
+
+Main.class: Main.java Lexer.java parser.java
+
+%.class: %.java
+ $(JAVAC) $^
+
+Lexer.java: lcalc.flex
+ $(JFLEX) lcalc.flex
+
+parser.java: ycalc.cup
+ $(CUP) ycalc.cup
+
+clean:
+ rm -f parser.java Lexer.java sym.java output.txt *.class *~
Index: /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/examples/cup/README
===================================================================
--- /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/examples/cup/README (revision 25585)
+++ /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/examples/cup/README (revision 25585)
@@ -0,0 +1,30 @@
+A small JFlex+Cup example
+
+It comes from a short article series in the Linux Gazette by Richard
+A. Sevenich and Christopher Lopes, titled "Compiler Construction
+Tools". The article series starts at
+
+http://www.linuxgazette.com/issue39/sevenich.html
+
+Small changes and updates to newest JFlex+Cup versions by Gerwin Klein
+
+
+To compile:
+>jflex lcalc.flex
+>java java_cup.Main < ycalc.cup
+>javac Main.java
+
+To run:
+>java Main test.txt
+
+
+Files:
+
+Main.java demo of a main program
+Makefile makefile to compile and test the example
+README this file
+lcalc.flex the lexer spec
+output.good how the output should look like for the test
+ycalc.cup the parser spec
+test.txt sample input for testing
+
Index: /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/examples/cup/lcalc.flex
===================================================================
--- /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/examples/cup/lcalc.flex (revision 25585)
+++ /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/examples/cup/lcalc.flex (revision 25585)
@@ -0,0 +1,142 @@
+/*
+ This example comes from a short article series in the Linux
+ Gazette by Richard A. Sevenich and Christopher Lopes, titled
+ "Compiler Construction Tools". The article series starts at
+
+ http://www.linuxgazette.com/issue39/sevenich.html
+
+ Small changes and updates to newest JFlex+Cup versions
+ by Gerwin Klein
+*/
+
+/*
+ Commented By: Christopher Lopes
+ File Name: lcalc.flex
+ To Create: > jflex lcalc.flex
+
+ and then after the parser is created
+ > javac Lexer.java
+*/
+
+/* --------------------------Usercode Section------------------------ */
+
+import java_cup.runtime.*;
+
+%%
+
+/* -----------------Options and Declarations Section----------------- */
+
+/*
+ The name of the class JFlex will create will be Lexer.
+ Will write the code to the file Lexer.java.
+*/
+%class Lexer
+
+/*
+ The current line number can be accessed with the variable yyline
+ and the current column number with the variable yycolumn.
+*/
+%line
+%column
+
+/*
+ Will switch to a CUP compatibility mode to interface with a CUP
+ generated parser.
+*/
+%cup
+
+/*
+ Declarations
+
+ Code between %{ and %}, both of which must be at the beginning of a
+ line, will be copied letter to letter into the lexer class source.
+ Here you declare member variables and functions that are used inside
+ scanner actions.
+*/
+%{
+ /* To create a new java_cup.runtime.Symbol with information about
+ the current token, the token will have no value in this
+ case. */
+ private Symbol symbol(int type) {
+ return new Symbol(type, yyline, yycolumn);
+ }
+
+ /* Also creates a new java_cup.runtime.Symbol with information
+ about the current token, but this object has a value. */
+ private Symbol symbol(int type, Object value) {
+ return new Symbol(type, yyline, yycolumn, value);
+ }
+%}
+
+
+/*
+ Macro Declarations
+
+ These declarations are regular expressions that will be used latter
+ in the Lexical Rules Section.
+*/
+
+/* A line terminator is a \r (carriage return), \n (line feed), or
+ \r\n. */
+LineTerminator = \r|\n|\r\n
+
+/* White space is a line terminator, space, tab, or line feed. */
+WhiteSpace = {LineTerminator} | [ \t\f]
+
+/* A literal integer is is a number beginning with a number between
+ one and nine followed by zero or more numbers between zero and nine
+ or just a zero. */
+dec_int_lit = 0 | [1-9][0-9]*
+
+/* A identifier integer is a word beginning a letter between A and
+ Z, a and z, or an underscore followed by zero or more letters
+ between A and Z, a and z, zero and nine, or an underscore. */
+dec_int_id = [A-Za-z_][A-Za-z_0-9]*
+
+%%
+/* ------------------------Lexical Rules Section---------------------- */
+
+/*
+ This section contains regular expressions and actions, i.e. Java
+ code, that will be executed when the scanner matches the associated
+ regular expression. */
+
+ /* YYINITIAL is the state at which the lexer begins scanning. So
+ these regular expressions will only be matched if the scanner is in
+ the start state YYINITIAL. */
+
+ {
+
+ /* Return the token SEMI declared in the class sym that was found. */
+ ";" { return symbol(sym.SEMI); }
+
+ /* Print the token found that was declared in the class sym and then
+ return it. */
+ "+" { System.out.print(" + "); return symbol(sym.PLUS); }
+ "-" { System.out.print(" - "); return symbol(sym.MINUS); }
+ "*" { System.out.print(" * "); return symbol(sym.TIMES); }
+ "/" { System.out.print(" / "); return symbol(sym.DIVIDE); }
+ "(" { System.out.print(" ( "); return symbol(sym.LPAREN); }
+ ")" { System.out.print(" ) "); return symbol(sym.RPAREN); }
+
+ /* If an integer is found print it out, return the token NUMBER
+ that represents an integer and the value of the integer that is
+ held in the string yytext which will get turned into an integer
+ before returning */
+ {dec_int_lit} { System.out.print(yytext());
+ return symbol(sym.NUMBER, new Integer(yytext())); }
+
+ /* If an identifier is found print it out, return the token ID
+ that represents an identifier and the default value one that is
+ given to all identifiers. */
+ {dec_int_id} { System.out.print(yytext());
+ return symbol(sym.ID, new Integer(1));}
+
+ /* Don't do anything if whitespace is found */
+ {WhiteSpace} { /* just skip what was found, do nothing */ }
+}
+
+
+/* No token was found for the input so through an error. Print out an
+ Illegal character message with the illegal character that was found. */
+[^] { throw new Error("Illegal character <"+yytext()+">"); }
Index: /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/examples/cup/output.good
===================================================================
--- /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/examples/cup/output.good (revision 25585)
+++ /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/examples/cup/output.good (revision 25585)
@@ -0,0 +1,5 @@
+2 + 4 = 6
+5 * ( 6 - 3 ) + 1 = 16
+6 / 3 * 5 + 20 = 30
+4 * 76 / 31 = 9
+1 - 1 - 1 = -1
Index: /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/examples/cup/test.txt
===================================================================
--- /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/examples/cup/test.txt (revision 25585)
+++ /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/examples/cup/test.txt (revision 25585)
@@ -0,0 +1,5 @@
+2+4;
+5*(6-3)+1;
+6/3*5+20;
+4*76/31;
+1-1-1;
Index: /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/examples/cup/ycalc.cup
===================================================================
--- /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/examples/cup/ycalc.cup (revision 25585)
+++ /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/examples/cup/ycalc.cup (revision 25585)
@@ -0,0 +1,234 @@
+/*
+ This example comes from a short article series in the Linux
+ Gazette by Richard A. Sevenich and Christopher Lopes, titled
+ "Compiler Construction Tools". The article series starts at
+
+ http://www.linuxgazette.com/issue39/sevenich.html
+
+ Small changes and updates to newest JFlex+Cup versions
+ by Gerwin Klein
+*/
+
+/*
+ Commented By: Christopher Lopes
+ File Name: ycalc.cup
+ To Create: > java java_cup.Main < ycalc.cup
+*/
+
+
+/* ----------------------Preliminary Declarations Section--------------------*/
+
+/* Import the class java_cup.runtime.* */
+import java_cup.runtime.*;
+
+/* Parser code to change the way the parser reports errors (include
+ line and column number of the error). */
+parser code {:
+
+ /* Change the method report_error so it will display the line and
+ column of where the error occurred in the input as well as the
+ reason for the error which is passed into the method in the
+ String 'message'. */
+ public void report_error(String message, Object info) {
+
+ /* Create a StringBuffer called 'm' with the string 'Error' in it. */
+ StringBuffer m = new StringBuffer("Error");
+
+ /* Check if the information passed to the method is the same
+ type as the type java_cup.runtime.Symbol. */
+ if (info instanceof java_cup.runtime.Symbol) {
+ /* Declare a java_cup.runtime.Symbol object 's' with the
+ information in the object info that is being typecasted
+ as a java_cup.runtime.Symbol object. */
+ java_cup.runtime.Symbol s = ((java_cup.runtime.Symbol) info);
+
+ /* Check if the line number in the input is greater or
+ equal to zero. */
+ if (s.left >= 0) {
+ /* Add to the end of the StringBuffer error message
+ the line number of the error in the input. */
+ m.append(" in line "+(s.left+1));
+ /* Check if the column number in the input is greater
+ or equal to zero. */
+ if (s.right >= 0)
+ /* Add to the end of the StringBuffer error message
+ the column number of the error in the input. */
+ m.append(", column "+(s.right+1));
+ }
+ }
+
+ /* Add to the end of the StringBuffer error message created in
+ this method the message that was passed into this method. */
+ m.append(" : "+message);
+
+ /* Print the contents of the StringBuffer 'm', which contains
+ an error message, out on a line. */
+ System.err.println(m);
+ }
+
+ /* Change the method report_fatal_error so when it reports a fatal
+ error it will display the line and column number of where the
+ fatal error occurred in the input as well as the reason for the
+ fatal error which is passed into the method in the object
+ 'message' and then exit.*/
+ public void report_fatal_error(String message, Object info) {
+ report_error(message, info);
+ System.exit(1);
+ }
+:};
+
+
+
+/* ------------Declaration of Terminals and Non Terminals Section----------- */
+
+/* Terminals (tokens returned by the scanner).
+
+ Terminals that have no value are listed first and then terminals
+ that do have an value, in this case an integer value, are listed on
+ the next line down. */
+terminal SEMI, PLUS, MINUS, TIMES, DIVIDE, LPAREN, RPAREN;
+terminal Integer NUMBER, ID;
+
+/* Non terminals used in the grammar section.
+
+ Non terminals that have an object value are listed first and then
+ non terminals that have an integer value are listed. An object
+ value means that it can be any type, it isn't set to a specific
+ type. So it could be an Integer or a String or whatever. */
+non terminal Object expr_list, expr_part;
+non terminal Integer expr, factor, term;
+
+
+/* -------------Precedence and Associatively of Terminals Section----------- */
+
+/*
+ Precedence of non terminals could be defined here. If you do define
+ precedence here you won't need to worry about precedence in the
+ Grammar Section, i.e. that TIMES should have a higher precedence
+ than PLUS.
+
+ The precedence defined here would look something like this where the
+ lower line always will have higher precedence than the line before it.
+
+ precedence left PLUS, MINUS;
+ precedence left TIMES, DIVIDE;
+*/
+
+
+/* ----------------------------Grammar Section-------------------- */
+
+/* The grammar for our parser.
+
+ expr_list ::= expr_list expr_part
+ | expr_part
+ expr_part ::= expr SEMI
+ expr ::= expr PLUS factor
+ | expr MINUS factor
+ | factor
+ factor ::= factor TIMES term
+ | factor DIVIDE term
+ | term
+ term ::= LPAREN expr RPAREN
+ | NUMBER
+ | ID
+*/
+
+/* 'expr_list' is the start of our grammar. It can lead to another
+ 'expr_list' followed by an 'expr_part' or it can just lead to an
+ 'expr_part'. The lhs of the non terminals 'expr_list' and
+ 'expr_part' that are in the rhs side of the production below need
+ to be found. Then the rhs sides of those non terminals need to be
+ followed in a similar manner, i.e. if there are any non terminals
+ in the rhs of those productions then the productions with those non
+ terminals need to be found and those rhs's followed. This process
+ keeps continuing until only terminals are found in the rhs of a
+ production. Then we can work our way back up the grammar bringing
+ any values that might have been assigned from a terminal. */
+
+ expr_list ::= expr_list expr_part
+ |
+ expr_part;
+
+/* 'expr_part' is an 'expr' followed by the terminal 'SEMI'. The ':e'
+ after the non terminal 'expr' is a label an is used to access the
+ value of 'expr' which will be an integer. The action for the
+ production lies between {: and :}. This action will print out the
+ line " = + e" where e is the value of 'expr'. Before the action
+ takes places we need to go deeper into the grammar since 'expr' is
+ a non terminal. Whenever a non terminal is encountered on the rhs
+ of a production we need to find the rhs of that non terminal until
+ there are no more non terminals in the rhs. So when we finish
+ going through the grammar and don't encounter any more non
+ terminals in the rhs productions will return until we get back to
+ 'expr' and at that point 'expr' will contain an integer value. */
+
+ expr_part ::= expr:e
+ {: System.out.println(" = " + e); :}
+ SEMI
+ ;
+
+/* 'expr' can lead to 'expr PLUS factor', 'expr MINUS factor', or
+ 'factor'. The 'TIMES' and 'DIVIDE' productions are not at this
+ level. They are at a lower level in the grammar which in affect
+ makes them have higher precedence. Actions for the rhs of the non
+ terminal 'expr' return a value to 'expr'. This value that is
+ created is an integer and gets stored in 'RESULT' in the action.
+ RESULT is the label that is assigned automatically to the rhs, in
+ this case 'expr'. If the rhs is just 'factor' then 'f' refers to
+ the non terminal 'factor'. The value of 'f' is retrieved with the
+ function 'intValue()' and will be stored in 'RESULT'. In the other
+ two cases 'f' and 'e' refers to the non terminals 'factor' and
+ 'expr' respectively with a terminal between them, either 'PLUS' or
+ 'MINUS'. The value of each is retrieved with the same function
+ 'intValue'. The values will be added or subtracted and then the
+ new integer will be stored in 'RESULT'.*/
+
+ expr ::= expr:e PLUS factor:f
+ {: RESULT = new Integer(e.intValue() + f.intValue()); :}
+ |
+ expr:e MINUS factor:f
+ {: RESULT = new Integer(e.intValue() - f.intValue()); :}
+ |
+ factor:f
+ {: RESULT = new Integer(f.intValue()); :}
+ ;
+
+/* 'factor' can lead to 'factor TIMES term', 'factor DIVIDE term', or
+ 'term'. Since the productions for TIMES and DIVIDE are lower in
+ the grammar than 'PLUS' and 'MINUS' they will have higher
+ precedence. The same sort of actions take place in the rhs of
+ 'factor' as in 'expr'. The only difference is the operations that
+ takes place on the values retrieved with 'intValue()', 'TIMES' and
+ 'DIVIDE' here instead of 'PLUS' and 'MINUS'. */
+
+ factor ::= factor:f TIMES term:t
+ {: RESULT = new Integer(f.intValue() * t.intValue()); :}
+ |
+ factor:f DIVIDE term:t
+ {: RESULT = new Integer(f.intValue() / t.intValue()); :}
+ |
+ term:t
+ {: RESULT = new Integer(t.intValue()); :}
+ ;
+
+/* 'term' can lead to 'LPAREN expr RPAREN', 'NUMBER', or 'ID'. The
+ first production has the non terminal 'expr' in it so the
+ production with its lhs side needs to be found and followed. The
+ next rhs has no non terminals. So the grammar ends here and can go
+ back up. When it goes back up it will bring the value that was
+ retrieved when the scanner encounter the token 'NUMBER'. 'RESULT'
+ is assigned 'n', which refers to 'NUMBER', as the action for this
+ production. The same action occurs for 'ID', except the 'i' is
+ used to refer to 'ID'. 'ID' is also the only thing on the rhs of
+ the production. And since 'ID' is a terminal the grammar will end
+ here and go back up. */
+
+ term ::= LPAREN expr:e RPAREN
+ {: RESULT = e; :}
+ |
+ NUMBER:n
+ {: RESULT = n; :}
+ |
+ ID:i
+ {: RESULT = i; :}
+ ;
Index: /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/examples/interpreter/AST.java
===================================================================
--- /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/examples/interpreter/AST.java (revision 25585)
+++ /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/examples/interpreter/AST.java (revision 25585)
@@ -0,0 +1,30 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright (C) 2001 Gerwin Klein *
+ * Copyright (C) 2001 Bernhard Rumpe *
+ * All rights reserved. *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License. See the file *
+ * COPYRIGHT for more information. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License along *
+ * with this program; if not, write to the Free Software Foundation, Inc., *
+ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *
+ * *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+/**
+ * General interface for nodes in the abstract syntax tree. Contains
+ * only the method toString which is already inherited from Object,
+ * so the interface doesn't add any functionality. It only provides
+ * a common super type for all elements in the AST.
+ */
+interface AST {
+ public String toString(); // already inherited from Object
+}
+
Index: /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/examples/interpreter/Main.java
===================================================================
--- /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/examples/interpreter/Main.java (revision 25585)
+++ /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/examples/interpreter/Main.java (revision 25585)
@@ -0,0 +1,85 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright (C) 2001 Gerwin Klein *
+ * Copyright (C) 2001 Bernhard Rumpe *
+ * All rights reserved. *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License. See the file *
+ * COPYRIGHT for more information. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License along *
+ * with this program; if not, write to the Free Software Foundation, Inc., *
+ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *
+ * *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+
+import java.io.*;
+
+/**
+ * Main program of the interpreter for the AS programming language.
+ * Based on JFlex/CUP.
+ *
+ * Steps:
+ * - scanning (Yylex)
+ * - context free parsing and AST building (yyparse)
+ * - build up symbol table (setSymtabs)
+ * - check context conditions (checkcontext)
+ * - prepare interpretation (prepInterp)
+ * - start interpretation (interpret)
+ */
+public class Main {
+
+ public static void main(String [] args) throws Exception {
+ Reader reader = null;
+
+ if (args.length == 1) {
+ File input = new File(args[0]);
+ if (!input.canRead()) {
+ System.out.println("Error: could not read ["+input+"]");
+ }
+ reader = new FileReader(input);
+ }
+ else {
+ reader = new InputStreamReader(System.in);
+ }
+
+ Yylex scanner = new Yylex(reader); // create scanner
+ SymTab symtab = new SymTab(); // set global symbol table
+ scanner.setSymtab(symtab);
+
+ parser parser = new parser(scanner); // create parser
+ Tprogram syntaxbaum = null;
+
+ try {
+ syntaxbaum = (Tprogram) parser.parse().value; // parse
+ }
+ catch (Exception e) {
+ e.printStackTrace();
+ }
+
+ // System.out.println(symtab);
+ System.out.println(syntaxbaum);
+
+ syntaxbaum.setSymtabs(); // set symbol table
+ // syntaxbaum.printSymtabs(); // print symbol table
+
+ syntaxbaum.checkcontext(); // CoCo (DefVar, DefFun, Arity)
+ if(contexterror>0) return;
+
+ syntaxbaum.prepInterp(); // var. indices and function pointers
+ // im Syntaxbaum setzen
+ syntaxbaum.interpret(); // interpretation
+ }
+
+ static int contexterror = 0; // number of errors in context conditions
+
+ public static void error(String s) {
+ System.out.println((contexterror++)+". "+s);
+ }
+}
Index: /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/examples/interpreter/Makefile
===================================================================
--- /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/examples/interpreter/Makefile (revision 25585)
+++ /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/examples/interpreter/Makefile (revision 25585)
@@ -0,0 +1,42 @@
+# uses JFlex >= 1.3.2, and CUP >= 0.10j
+#
+# targets:
+#
+# make all
+# generates lexer, and parser, and compiles all *.java files
+#
+# make run (or just: make)
+# starts the program on a test example
+#
+
+
+
+.SUFFIXES: $(SUFFIXES) .class .java
+
+.java.class:
+ javac $*.java
+
+FILE= Yylex.java parser.java sym.java \
+ SymTab.java AST.java \
+ Tnumber.java Tident.java Texp.java \
+ Tfun.java Texpinfix.java Tuminus.java \
+ Tboolexp.java Tifthenelse.java \
+ Tdekl.java Tdekllist.java \
+ Tparlist.java Texplist.java Tprogram.java \
+ Main.java \
+ SymtabEntry.java STEfun.java STEvar.java
+
+
+run: all
+ java Main < example.as
+
+all: Yylex.java parser.java $(FILE:java=class)
+
+clean:
+ rm -f *.class *~ *.bak Yylex.java parser.java sym.java
+
+Yylex.java: scanner.flex
+ jflex scanner.flex
+
+parser.java: parser.cup
+ java java_cup.Main -interface < parser.cup
Index: /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/examples/interpreter/README
===================================================================
--- /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/examples/interpreter/README (revision 25585)
+++ /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/examples/interpreter/README (revision 25585)
@@ -0,0 +1,31 @@
+This directory contains an interpreter for a small functional
+programming language (called "AS"). It uses JFlex and CUP.
+
+Directory contents:
+
+- Main.java is the main program. It reads an AS program from
+ std in and interprets it.
+
+- Makefile runs jflex, cup, javac and the compiled interpreter
+
+- Classes beginning with "T" implement the abstract syntax tree.
+ They also contain context condition checking and the interpreter.
+
+- Symtab.java, SymtabEntry.java, STEfun.java, STEvar.java implement
+ the symbol table.
+
+- scanner.lex and parser.cup contain the scanner and parser.
+
+- example.as is an example program in AS
+
+
+The language is described in:
+Manfred Broy: Einfuehrung in die Informatik, Springer Verlag
+
+The files are a solution to excercise 3.40 in the book:
+Manfred Broy,Bernhard Rumpe:
+Uebungen zur Einfuehrung in die Informatik --
+Strukturierte Aufgabensammlung mit Musterloesungen,
+Springer Verlag, 2001
+
+Both books are only available in German. Sorry.
Index: /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/examples/interpreter/STEfun.java
===================================================================
--- /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/examples/interpreter/STEfun.java (revision 25585)
+++ /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/examples/interpreter/STEfun.java (revision 25585)
@@ -0,0 +1,54 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright (C) 2001 Gerwin Klein *
+ * Copyright (C) 2001 Bernhard Rumpe *
+ * All rights reserved. *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License. See the file *
+ * COPYRIGHT for more information. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License along *
+ * with this program; if not, write to the Free Software Foundation, Inc., *
+ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *
+ * *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+
+/**
+ * Symbol table entry for functions.
+ *
+ * Contains arity and reference to location of definition
+ */
+class STEfun extends SymtabEntry {
+ int arity;
+ Tdekl dekl; // location of definition
+
+ public STEfun(String f, Tdekl d, int a) {
+ super(f);
+ dekl=d;
+ arity=a;
+ }
+
+ public int kind() {
+ return SymtabEntry.FUN;
+ }
+
+ public String toString() {
+ return "function "+name+", arity "+arity;
+ }
+
+ public int arity() {
+ return arity;
+ }
+
+ public Tdekl getDekl() {
+ return dekl;
+ }
+}
+
+
Index: /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/examples/interpreter/STEvar.java
===================================================================
--- /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/examples/interpreter/STEvar.java (revision 25585)
+++ /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/examples/interpreter/STEvar.java (revision 25585)
@@ -0,0 +1,57 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright (C) 2001 Gerwin Klein *
+ * Copyright (C) 2001 Bernhard Rumpe *
+ * All rights reserved. *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License. See the file *
+ * COPYRIGHT for more information. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License along *
+ * with this program; if not, write to the Free Software Foundation, Inc., *
+ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *
+ * *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+
+/**
+ * Symbol table entry for variables.
+ *
+ * Contains index in the parameter list and a flag if it
+ * is an input variable.
+ */
+class STEvar extends SymtabEntry {
+ boolean is_input;
+ int index;
+
+ public STEvar(String v, boolean ii, int ind) {
+ super(v);
+ is_input=ii;
+ index=ind;
+ }
+
+ public int kind() {
+ return SymtabEntry.VAR;
+ }
+
+ public String toString() {
+ if (is_input)
+ return "input var "+name+" ("+index+")";
+ else
+ return "parameter "+name+" ("+index+")";
+ }
+
+ public int getIndex() {
+ return index;
+ }
+
+ public boolean isInput() {
+ return is_input;
+ }
+}
+
Index: /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/examples/interpreter/SymTab.java
===================================================================
--- /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/examples/interpreter/SymTab.java (revision 25585)
+++ /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/examples/interpreter/SymTab.java (revision 25585)
@@ -0,0 +1,78 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright (C) 2001 Gerwin Klein *
+ * Copyright (C) 2001 Bernhard Rumpe *
+ * All rights reserved. *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License. See the file *
+ * COPYRIGHT for more information. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License along *
+ * with this program; if not, write to the Free Software Foundation, Inc., *
+ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *
+ * *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+
+import java.util.*;
+
+/**
+ * Symbol table for the interpreter, contains information about
+ * variables and functions.
+ *
+ * For every binding location of a name a symbol will be created.
+ * The symbol tables are connected hierarchically by pointers to
+ * the predecessor. Lookup takes predecessors into account.
+ */
+public class SymTab {
+ Hashtable h; // contains the liste of words
+ // key: String, value: SymtabEntry
+
+ SymTab pred; // predecessor symbol table (if exists)
+
+ public SymTab() {
+ this(null);
+ }
+
+ public SymTab(SymTab p) {
+ h = new Hashtable();
+ pred = p;
+ }
+
+ public boolean enter(String s, SymtabEntry e) {
+ Object value = lookup(s);
+ h.put(s, e);
+ return(value==null);
+ }
+
+ public SymtabEntry lookup(String s) {
+ Object value = h.get(s);
+ if (value==null && pred!=null)
+ value = pred.lookup(s);
+ return ((SymtabEntry)value);
+ }
+
+ public String toString() { // for output with print
+ String res = "symbol table\n=============\n";
+ Enumeration e = h.keys();
+ String key;
+
+ while(e.hasMoreElements()) {
+ key = (String)e.nextElement();
+ res += key+" \t"+h.get(key)+"\n";
+ }
+
+ if (pred!=null) res+="++ predecessor!\n";
+ return(res);
+ }
+
+ public int size() {
+ return(h.size());
+ }
+}
+
Index: /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/examples/interpreter/SymtabEntry.java
===================================================================
--- /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/examples/interpreter/SymtabEntry.java (revision 25585)
+++ /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/examples/interpreter/SymtabEntry.java (revision 25585)
@@ -0,0 +1,48 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright (C) 2001 Gerwin Klein *
+ * Copyright (C) 2001 Bernhard Rumpe *
+ * All rights reserved. *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License. See the file *
+ * COPYRIGHT for more information. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License along *
+ * with this program; if not, write to the Free Software Foundation, Inc., *
+ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *
+ * *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+
+/**
+ * Symbol table entry for names, there are subclasses for
+ * variables and functions.
+ *
+ * Defines constants UNKNOWN, VAR und FUN as kinds of
+ * symbol table entries.
+ */
+class SymtabEntry {
+ String name;
+
+ public SymtabEntry(String v) {
+ name=v;
+ }
+
+ public int kind() {
+ return UNKNOWN;
+ }
+
+ public String toString() {
+ return("unknown "+name);
+ }
+
+ static final int UNKNOWN = 12;
+ static final int VAR = 13;
+ static final int FUN = 14;
+}
+
Index: /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/examples/interpreter/Tboolexp.java
===================================================================
--- /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/examples/interpreter/Tboolexp.java (revision 25585)
+++ /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/examples/interpreter/Tboolexp.java (revision 25585)
@@ -0,0 +1,64 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright (C) 2001 Gerwin Klein *
+ * Copyright (C) 2001 Bernhard Rumpe *
+ * All rights reserved. *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License. See the file *
+ * COPYRIGHT for more information. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License along *
+ * with this program; if not, write to the Free Software Foundation, Inc., *
+ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *
+ * *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+
+/**
+ * AST node for bool expressions
+ */
+class Tboolexp implements AST {
+ Texp exp1, exp2; // left and right subexpression
+ char kind; // '=', '<' and '!' for "<="
+
+ public Tboolexp(Texp e1, char k, Texp e2) {
+ exp1=e1;
+ kind=k;
+ exp2=e2;
+ }
+
+ public String toString() {
+ if (kind!='!')
+ return(""+exp1+kind+exp2);
+ else
+ return(exp1+"<="+exp2);
+ }
+
+ public void checkcontext(SymTab st) { // context conditions
+ exp1.checkcontext(st);
+ exp2.checkcontext(st);
+ }
+
+ public void prepInterp(SymTab st) { // set pointers and indices
+ exp1.prepInterp(st);
+ exp2.prepInterp(st);
+ }
+
+ public boolean interpret(int[] in, int[] par) {
+ int e1 = exp1.interpret(in,par);
+ int e2 = exp2.interpret(in,par);
+ switch(kind) {
+ case '=': return(e1==e2);
+ case '<': return(e1 *
+ * Copyright (C) 2001 Bernhard Rumpe *
+ * All rights reserved. *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License. See the file *
+ * COPYRIGHT for more information. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License along *
+ * with this program; if not, write to the Free Software Foundation, Inc., *
+ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *
+ * *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+
+/**
+ * AST node for function declarations.
+ *
+ * Also contains a reference to the symbol table of
+ * the paramaters and their arity.
+ */
+class Tdekl implements AST {
+ Tident ident; // identifier
+ Tparlist parlist; // liste of parameter
+ Texp exp; // function body
+
+ public Tdekl(Tident i, Tparlist p, Texp e) {
+ parlist=p;
+ ident=i;
+ exp=e;
+ }
+
+ public String toString() {
+ return(ident+"("+parlist+") = \n "+exp);
+ }
+
+ SymTab params; // symbol table of the parameters
+ int arity;
+
+ public void setSymtab(SymTab st) {
+ params = new SymTab(st);
+ parlist.setSymtab(params,false,0);
+ arity = params.size();
+
+ boolean isNew = st.enter(ident.toString(),
+ new STEfun(ident.toString(),this,arity));
+ // CoCo (Fun)
+ if(!isNew) Main.error("funktion "+ident+" defined twice!");
+ }
+
+ public void printSymtabs() {
+ System.out.print("funktion "+ident.toString()+"\n"+params);
+ }
+
+ public void checkcontext() {
+ exp.checkcontext(params); // CoCo (DefFun,DefVar,Arity)
+ }
+
+ public void prepInterp(SymTab st) { // set pointers and indices
+ exp.prepInterp(params);
+ }
+
+ public int interpret(int[] in, int[] par) {
+ return(exp.interpret(in,par));
+ }
+
+ public int arity() { return(arity); }
+}
+
Index: /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/examples/interpreter/Tdekllist.java
===================================================================
--- /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/examples/interpreter/Tdekllist.java (revision 25585)
+++ /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/examples/interpreter/Tdekllist.java (revision 25585)
@@ -0,0 +1,69 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright (C) 2001 Gerwin Klein *
+ * Copyright (C) 2001 Bernhard Rumpe *
+ * All rights reserved. *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License. See the file *
+ * COPYRIGHT for more information. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License along *
+ * with this program; if not, write to the Free Software Foundation, Inc., *
+ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *
+ * *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+
+/**
+ * AST node for declaration lists of functions
+ */
+class Tdekllist implements AST {
+ Tdekllist dekllist; // rest list (optional null)
+ Tdekl dekl; // declaration
+
+ public Tdekllist(Tdekllist p, Tdekl e) {
+ dekllist=p;
+ dekl=e;
+ }
+
+ public Tdekllist(Tdekl e) {
+ dekllist=null;
+ dekl=e;
+ }
+
+ public String toString() {
+ if (dekllist!=null)
+ return(dekllist+",\n"+dekl);
+ else
+ return(dekl.toString());
+ }
+
+ public void setSymtab(SymTab st) {
+ if (dekllist!=null)
+ dekllist.setSymtab(st);
+ dekl.setSymtab(st);
+ }
+
+ public void printSymtabs() {
+ if (dekllist!=null)
+ dekllist.printSymtabs();
+ dekl.printSymtabs();
+ }
+
+ public void checkcontext() {
+ if (dekllist!=null)
+ dekllist.checkcontext();
+ dekl.checkcontext(); // CoCo (DefFun,DefVar,Arity)
+ } // in function body
+
+ public void prepInterp(SymTab st) { // set pointers and indices
+ dekl.prepInterp(st);
+ if (dekllist!=null) dekllist.prepInterp(st);
+ }
+}
+
Index: /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/examples/interpreter/Texp.java
===================================================================
--- /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/examples/interpreter/Texp.java (revision 25585)
+++ /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/examples/interpreter/Texp.java (revision 25585)
@@ -0,0 +1,43 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright (C) 2001 Gerwin Klein *
+ * Copyright (C) 2001 Bernhard Rumpe *
+ * All rights reserved. *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License. See the file *
+ * COPYRIGHT for more information. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License along *
+ * with this program; if not, write to the Free Software Foundation, Inc., *
+ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *
+ * *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+
+/**
+ * AST node for an integer expression.
+ *
+ * The non terminal exp is the sum of multiple variants and
+ * therefore modeled as an abstract class.
+ *
+ * The interpretation function interpret is called with
+ * valuations of input variables in and parameters
+ * par. Before interpret can be called, pointers
+ * and variable indices must be set with prepInterp.
+ */
+abstract class Texp implements AST {
+ // test context conditions (DefFun,DefVar,Arity)
+ abstract public void checkcontext(SymTab st);
+
+ // set pointers and indices for variables and functions
+ abstract public void prepInterp(SymTab st);
+
+ // interpretation
+ abstract public int interpret(int[] in, int[] par);
+}
+
Index: /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/examples/interpreter/Texpinfix.java
===================================================================
--- /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/examples/interpreter/Texpinfix.java (revision 25585)
+++ /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/examples/interpreter/Texpinfix.java (revision 25585)
@@ -0,0 +1,64 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright (C) 2001 Gerwin Klein *
+ * Copyright (C) 2001 Bernhard Rumpe *
+ * All rights reserved. *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License. See the file *
+ * COPYRIGHT for more information. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License along *
+ * with this program; if not, write to the Free Software Foundation, Inc., *
+ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *
+ * *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+
+/**
+ * AST node for infix expressions
+ */
+class Texpinfix extends Texp implements AST {
+ Texp exp1, exp2; // left and right sub expression
+ char kind; // kind ('+', '-', '*', '/')
+
+ public Texpinfix(Texp e1, char k, Texp e2) {
+ exp1=e1;
+ kind=k;
+ exp2=e2;
+ }
+
+ public String toString() {
+ return("("+exp1+kind+exp2+")");
+ }
+
+ public void checkcontext(SymTab st) { // context conditions
+ exp1.checkcontext(st);
+ exp2.checkcontext(st);
+ }
+
+ public void prepInterp(SymTab st) { // set pointers und indices
+ exp1.prepInterp(st);
+ exp2.prepInterp(st);
+ }
+
+ public int interpret(int[] in, int[] par) {
+ int e1 = exp1.interpret(in,par);
+ int e2 = exp2.interpret(in,par);
+
+ switch (kind) {
+ case '+': return(e1+e2);
+ case '-': return(e1-e2);
+ case '*': return(e1*e2);
+ case '/': return(e1/e2);
+ }
+
+ return -1; // error
+ }
+}
+
+
Index: /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/examples/interpreter/Texplist.java
===================================================================
--- /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/examples/interpreter/Texplist.java (revision 25585)
+++ /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/examples/interpreter/Texplist.java (revision 25585)
@@ -0,0 +1,73 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright (C) 2001 Gerwin Klein *
+ * Copyright (C) 2001 Bernhard Rumpe *
+ * All rights reserved. *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License. See the file *
+ * COPYRIGHT for more information. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License along *
+ * with this program; if not, write to the Free Software Foundation, Inc., *
+ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *
+ * *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+
+/**
+ * AST node for a list of expressions.
+ *
+ * The interpretation of a list of expressions stores the
+ * results of the expressions in an array that can be used
+ * as parameter list for function calls.
+ */
+class Texplist implements AST {
+ Texplist explist; // next list element (optional null)
+ Texp exp; // expression of this list node
+
+ public Texplist(Texplist p, Texp e) {
+ explist=p;
+ exp=e;
+ }
+
+ public Texplist(Texp e) {
+ explist=null;
+ exp=e;
+ }
+
+ public String toString() {
+ if (explist!=null)
+ return explist+","+exp;
+ else
+ return exp.toString();
+ }
+
+ public void checkcontext(SymTab st) {
+ if (explist!=null)
+ explist.checkcontext(st);
+ exp.checkcontext(st); // CoCo (DefFun,DefVar,Arity)
+ } // in expression
+
+ public int length() {
+ if (explist!=null)
+ return 1+explist.length();
+ else
+ return 1;
+ }
+
+ public void prepInterp(SymTab st) { // set pointers and indices
+ exp.prepInterp(st);
+ if (explist!=null) explist.prepInterp(st);
+ }
+
+ public void interpret(int[] in, int[] par, int[] res, int index) {
+ res[index] = exp.interpret(in,par);
+ if (explist!=null) explist.interpret(in,par,res,index+1);
+ }
+}
+
Index: /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/examples/interpreter/Tfun.java
===================================================================
--- /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/examples/interpreter/Tfun.java (revision 25585)
+++ /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/examples/interpreter/Tfun.java (revision 25585)
@@ -0,0 +1,66 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright (C) 2001 Gerwin Klein *
+ * Copyright (C) 2001 Bernhard Rumpe *
+ * All rights reserved. *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License. See the file *
+ * COPYRIGHT for more information. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License along *
+ * with this program; if not, write to the Free Software Foundation, Inc., *
+ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *
+ * *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+
+/**
+ * AST node for function application.
+ *
+ * Also contains pointer to declaration location of the function.
+ */
+class Tfun extends Texp implements AST {
+ Tident ident; // name of the function
+ Texplist explist; // parameter list
+
+ public Tfun(Tident i, Texplist e) {
+ ident=i;
+ explist=e;
+ }
+
+ public String toString() {
+ return ident+"("+explist+")";
+ }
+
+ public void checkcontext(SymTab st) { // CoCo (DefFun,Arity)
+ explist.checkcontext(st);
+ SymtabEntry ste = st.lookup(ident.toString());
+ if (ste==null)
+ Main.error("function not defined: "+ident);
+ else if (ste.kind() != SymtabEntry.FUN)
+ Main.error("variable used as funktion: "+ident);
+ else if (((STEfun)ste).arity() != explist.length())
+ Main.error("wrong arity at function call: "+ident);
+ }
+
+ Tdekl fundekl; // pointer to location of function declaration
+
+ // set pointers and indices
+ public void prepInterp(SymTab st) {
+ fundekl = ((STEfun)st.lookup(ident.toString())).getDekl();
+ explist.prepInterp(st);
+ }
+
+ public int interpret(int[] in, int[] par) {
+ int[] newparams = new int[fundekl.arity()];
+ explist.interpret(in,par,newparams,0);
+ return fundekl.interpret(in,newparams);
+ }
+}
+
+
Index: /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/examples/interpreter/Tident.java
===================================================================
--- /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/examples/interpreter/Tident.java (revision 25585)
+++ /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/examples/interpreter/Tident.java (revision 25585)
@@ -0,0 +1,62 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright (C) 2001 Gerwin Klein *
+ * Copyright (C) 2001 Bernhard Rumpe *
+ * All rights reserved. *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License. See the file *
+ * COPYRIGHT for more information. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License along *
+ * with this program; if not, write to the Free Software Foundation, Inc., *
+ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *
+ * *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+
+/**
+ * AST node for an identifier
+ */
+class Tident extends Texp implements AST {
+ String name;
+
+ public Tident(String s) {
+ name = s;
+ }
+
+ public String toString() {
+ return name;
+ }
+
+ public void checkcontext(SymTab st) { // CoCo (DefVar)
+ SymtabEntry ste = st.lookup(name);
+
+ if (ste==null)
+ Main.error("variable not defined: "+name);
+ else if (ste.kind() != SymtabEntry.VAR)
+ Main.error("function used as variable: "+name);
+ }
+
+ int index; // number of ident in environment
+ boolean is_input; // is it an input variable?
+
+ public void prepInterp(SymTab st) { // set index for environment
+ STEvar ste = (STEvar)st.lookup(name);
+ index = ste.getIndex();
+ is_input = ste.isInput();
+ }
+
+ public int interpret(int[] in, int[] par) {
+ if (is_input)
+ return(in[index]);
+ else
+ return(par[index]);
+ }
+}
+
+
Index: /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/examples/interpreter/Tifthenelse.java
===================================================================
--- /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/examples/interpreter/Tifthenelse.java (revision 25585)
+++ /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/examples/interpreter/Tifthenelse.java (revision 25585)
@@ -0,0 +1,59 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright (C) 2001 Gerwin Klein *
+ * Copyright (C) 2001 Bernhard Rumpe *
+ * All rights reserved. *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License. See the file *
+ * COPYRIGHT for more information. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License along *
+ * with this program; if not, write to the Free Software Foundation, Inc., *
+ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *
+ * *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+
+/**
+ * AST node for if-then-else expressions
+ */
+class Tifthenelse extends Texp implements AST {
+ Tboolexp boolexp; // condition
+ Texp exp1, exp2; // then and else branch
+
+ public Tifthenelse(Tboolexp b, Texp e1, Texp e2) {
+ boolexp=b;
+ exp1=e1;
+ exp2=e2;
+ }
+
+ public String toString() {
+ return "if "+boolexp+" then "+exp1+" else "+exp2+" fi";
+ }
+
+ public void checkcontext(SymTab st) {
+ boolexp.checkcontext(st);
+ exp1.checkcontext(st);
+ exp2.checkcontext(st);
+ }
+
+ public void prepInterp(SymTab st) {
+ boolexp.prepInterp(st);
+ exp1.prepInterp(st);
+ exp2.prepInterp(st);
+ }
+
+ public int interpret(int[] in, int[] par) {
+ boolean b = boolexp.interpret(in,par);
+ if (b)
+ return exp1.interpret(in,par);
+ else
+ return exp2.interpret(in,par);
+ }
+}
+
Index: /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/examples/interpreter/Tnumber.java
===================================================================
--- /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/examples/interpreter/Tnumber.java (revision 25585)
+++ /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/examples/interpreter/Tnumber.java (revision 25585)
@@ -0,0 +1,47 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright (C) 2001 Gerwin Klein *
+ * Copyright (C) 2001 Bernhard Rumpe *
+ * All rights reserved. *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License. See the file *
+ * COPYRIGHT for more information. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License along *
+ * with this program; if not, write to the Free Software Foundation, Inc., *
+ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *
+ * *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+
+/**
+ * AST node for a number
+ */
+class Tnumber extends Texp implements AST {
+ int n; // value of the number
+
+ public Tnumber(String s) {
+ try { n = Integer.parseInt(s); }
+ catch (NumberFormatException e) { n=-1; };
+ }
+
+ public String toString() {
+ return(""+n);
+ }
+
+ public void checkcontext(SymTab st) {
+ }
+
+ public void prepInterp(SymTab st) {
+ }
+
+ public int interpret(int[] in, int[] par) {
+ return(n);
+ }
+}
+
Index: /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/examples/interpreter/Tparlist.java
===================================================================
--- /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/examples/interpreter/Tparlist.java (revision 25585)
+++ /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/examples/interpreter/Tparlist.java (revision 25585)
@@ -0,0 +1,54 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright (C) 2001 Gerwin Klein *
+ * Copyright (C) 2001 Bernhard Rumpe *
+ * All rights reserved. *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License. See the file *
+ * COPYRIGHT for more information. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License along *
+ * with this program; if not, write to the Free Software Foundation, Inc., *
+ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *
+ * *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+
+/**
+ * AST node for a parameter list.
+ */
+class Tparlist implements AST {
+ Tparlist parlist; // rest of the liste (optional null)
+ Tident ident; // identifier
+
+ public Tparlist(Tparlist p, Tident i) {
+ parlist=p;
+ ident=i;
+ }
+
+ public Tparlist(Tident i) {
+ parlist=null;
+ ident=i;
+ }
+
+ public String toString() {
+ if (parlist!=null)
+ return parlist+","+ident;
+ else
+ return ident.toString();
+ }
+
+ public void setSymtab(SymTab st, boolean isInput, int index) {
+ boolean isNew = st.enter(ident.toString(),
+ new STEvar(ident.toString(), isInput, index));
+
+ if (!isNew) Main.error("Variable "+ident+" defined twice!");
+ if (parlist!=null) parlist.setSymtab(st, isInput, index+1);
+ }
+}
+
Index: /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/examples/interpreter/Tprogram.java
===================================================================
--- /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/examples/interpreter/Tprogram.java (revision 25585)
+++ /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/examples/interpreter/Tprogram.java (revision 25585)
@@ -0,0 +1,99 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright (C) 2001 Gerwin Klein *
+ * Copyright (C) 2001 Bernhard Rumpe *
+ * All rights reserved. *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License. See the file *
+ * COPYRIGHT for more information. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License along *
+ * with this program; if not, write to the Free Software Foundation, Inc., *
+ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *
+ * *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+
+/**
+ * AST node for the whole program (top node).
+ *
+ * Also contains two symbol tables, one for input variables,
+ * one for function names.
+ *
+ * All operations like context check, symbol table build up
+ * etc. start here.
+ */
+class Tprogram implements AST {
+
+ Tparlist parlist; // input variables
+ Tdekllist dekllist; // function declarations
+ Texplist explist; // result expressions
+ Texplist arguments; // input values
+
+ public Tprogram(Tparlist p, Tdekllist d, Texplist e, Texplist a) {
+ parlist=p;
+ dekllist=d;
+ explist=e;
+ arguments=a;
+ }
+
+ public String toString() {
+ return("Program:\n=============\ninput "+parlist+
+ "\nfunctions\n"+dekllist+"\noutput "+explist+
+ "\narguments "+arguments+"\nend");
+ }
+
+ SymTab inputs; // table of input variables
+ SymTab functions; // table of functions
+
+ public void setSymtabs() { // calculate symbol table entries
+ inputs = new SymTab(); // set input variables
+ parlist.setSymtab(inputs, true, 0);
+ functions = new SymTab(inputs);
+ dekllist.setSymtab(functions);
+ }
+
+ public void printSymtabs() {
+ System.out.print("Input variables-\n"+inputs);
+ System.out.print("Functions-\n"+functions);
+ dekllist.printSymtabs();
+ }
+
+ public void checkcontext() {
+ dekllist.checkcontext(); // CoCo (DefFun,DefVar,Arity)
+ // in function bodies
+ explist.checkcontext(functions); // CoCo (DefFun,DefVar,Arity)
+ // in result expressions
+ arguments.checkcontext(new SymTab()); // CoCo (constants)
+ // in arguments
+ if (arguments.length()!=inputs.size())
+ Main.error("Argument list and input variables list differ!");
+ }
+
+ public void prepInterp() { // set pointers and indices
+ dekllist.prepInterp(functions);
+ explist.prepInterp(functions);
+ }
+
+ public void interpret() {
+ int[] inputEnv = new int[inputs.size()]; // set input
+
+ arguments.interpret(null,null,inputEnv,0);
+
+ System.out.println("Result:\n=============");
+
+ int[] ergebnis = new int[explist.length()];
+ explist.interpret(inputEnv,null,ergebnis,0); // calculate result
+
+ int i;
+ for (i=explist.length()-1; i > 0; i--)
+ System.out.print(ergebnis[i]+", ");
+ System.out.println(ergebnis[i]);
+ }
+}
+
Index: /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/examples/interpreter/Tuminus.java
===================================================================
--- /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/examples/interpreter/Tuminus.java (revision 25585)
+++ /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/examples/interpreter/Tuminus.java (revision 25585)
@@ -0,0 +1,49 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright (C) 2001 Gerwin Klein *
+ * Copyright (C) 2001 Bernhard Rumpe *
+ * All rights reserved. *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License. See the file *
+ * COPYRIGHT for more information. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License along *
+ * with this program; if not, write to the Free Software Foundation, Inc., *
+ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *
+ * *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+
+/**
+ * AST node for unary minus expressions.
+ */
+class Tuminus extends Texp implements AST {
+
+ Texp exp; // the negated expression
+
+ public Tuminus(Texp e) {
+ exp=e;
+ }
+
+ public String toString() {
+ return "-"+exp;
+ }
+
+ public void checkcontext(SymTab st) {
+ exp.checkcontext(st);
+ }
+
+ public void prepInterp(SymTab st) {
+ exp.prepInterp(st);
+ }
+
+ public int interpret(int[] in, int[] par) {
+ return -(exp.interpret(in,par));
+ }
+}
+
Index: /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/examples/interpreter/build.xml
===================================================================
--- /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/examples/interpreter/build.xml (revision 25585)
+++ /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/examples/interpreter/build.xml (revision 25585)
@@ -0,0 +1,38 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Index: /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/examples/interpreter/example.as
===================================================================
--- /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/examples/interpreter/example.as (revision 25585)
+++ /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/examples/interpreter/example.as (revision 25585)
@@ -0,0 +1,16 @@
+
+// example program for interpreter testing
+// contains division and modulo functins
+
+input a,b
+functions div(x,y) = if x < y
+ then 0
+ else div(x-y,y)+1
+ fi,
+ mod(x,y) = if x < y
+ then x
+ else mod(x-y,y)
+ fi
+output div(a,b), mod(a,b)
+arguments 324, 17
+end
Index: /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/examples/interpreter/parser.cup
===================================================================
--- /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/examples/interpreter/parser.cup (revision 25585)
+++ /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/examples/interpreter/parser.cup (revision 25585)
@@ -0,0 +1,112 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright (C) 2001 Gerwin Klein *
+ * Copyright (C) 2001 Bernhard Rumpe *
+ * All rights reserved. *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License. See the file *
+ * COPYRIGHT for more information. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License along *
+ * with this program; if not, write to the Free Software Foundation, Inc., *
+ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *
+ * *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+
+// definition of tokens, if applicable with token type
+terminal INPUT, FUNCTIONS, OUTPUT, END, ARGUMENTS;
+terminal IF, THEN, ELSE, FI, ERROR;
+terminal COMMA, LPAR, RPAR;
+terminal EQ, LE, LEQ, MINUS, PLUS, TIMES, DIV, UMINUS;
+
+terminal String ID, NUMBER;
+
+non terminal Tprogram program;
+non terminal Tparlist parlist;
+non terminal Texplist explist;
+non terminal Tdekllist dekllist;
+non terminal Tdekl dekl;
+non terminal Texp exp;
+non terminal Tboolexp boolexp;
+non terminal Tident ident;
+non terminal Tnumber number;
+
+
+// precedences, left associativity
+precedence left EQ, LE, LEQ;
+precedence left MINUS, PLUS;
+precedence left TIMES, DIV;
+precedence left UMINUS;
+
+
+// here the rules start
+program ::= INPUT parlist:p FUNCTIONS dekllist:d OUTPUT explist:o
+ ARGUMENTS explist:a END
+ {: RESULT = new Tprogram(p,d,o,a); :}
+ ;
+
+parlist ::= ident:i
+ {: RESULT = new Tparlist(i); :}
+ | parlist:p COMMA ident:i
+ {: RESULT = new Tparlist(p,i); :}
+ ;
+
+explist ::= exp:e
+ {: RESULT = new Texplist(e); :}
+ | explist:l COMMA exp:e
+ {: RESULT = new Texplist(l,e); :}
+ ;
+
+dekllist ::= dekl:d
+ {: RESULT = new Tdekllist(d);:}
+ | dekllist:l COMMA dekl:d
+ {: RESULT = new Tdekllist(l,d); :}
+ ;
+
+dekl ::= ident:i LPAR parlist:p RPAR EQ exp:e
+ {: RESULT = new Tdekl(i,p,e); :}
+ ;
+
+exp ::= number:n
+ {: RESULT = n; :}
+ | ident:i
+ {: RESULT = i; :}
+ | ident:i LPAR explist:e RPAR
+ {: RESULT = new Tfun(i,e); :}
+ | LPAR exp:e RPAR
+ {: RESULT = e; :}
+ | MINUS exp:e
+ {: RESULT = new Tuminus(e); :} %prec UMINUS
+ | exp:l PLUS exp:r
+ {: RESULT = new Texpinfix(l,'+',r); :}
+ | exp:l TIMES exp:r
+ {: RESULT = new Texpinfix(l,'*',r); :}
+ | exp:l DIV exp:r
+ {: RESULT = new Texpinfix(l,'/',r); :}
+ | exp:l MINUS exp:r
+ {: RESULT = new Texpinfix(l,'-',r); :}
+ | IF boolexp:b THEN exp:t ELSE exp:e FI
+ {: RESULT = new Tifthenelse(b,t,e); :}
+ ;
+
+boolexp ::= exp:l EQ exp:r
+ {: RESULT = new Tboolexp(l,'=',r); :}
+ | exp:l LE exp:r
+ {: RESULT = new Tboolexp(l,'<',r); :}
+ | exp:l LEQ exp:r
+ {: RESULT = new Tboolexp(l,'!',r); :}
+ ;
+
+ident ::= ID:n
+ {: RESULT = new Tident(n); :}
+ ;
+
+number ::= NUMBER:z
+ {: RESULT = new Tnumber(z); :}
+ ;
Index: /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/examples/interpreter/scanner.flex
===================================================================
--- /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/examples/interpreter/scanner.flex (revision 25585)
+++ /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/examples/interpreter/scanner.flex (revision 25585)
@@ -0,0 +1,71 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright (C) 2001 Gerwin Klein *
+ * Copyright (C) 2001 Bernhard Rumpe *
+ * All rights reserved. *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License. See the file *
+ * COPYRIGHT for more information. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License along *
+ * with this program; if not, write to the Free Software Foundation, Inc., *
+ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *
+ * *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+
+import java_cup.runtime.Symbol;
+
+%%
+
+%cup
+%implements sym
+
+%{
+ SymTab symtab; // externe symbol table
+
+ public void setSymtab(SymTab symtab) {
+ this.symtab = symtab;
+ }
+
+ private Symbol sym(int sym) {
+ return new Symbol(sym);
+ }
+
+ private Symbol sym(int sym, Object val) {
+ return new Symbol(sym, val);
+ }
+%}
+
+%%
+
+"arguments" { return sym(ARGUMENTS); }
+"input" { return sym(INPUT); }
+"functions" { return sym(FUNCTIONS); }
+"output" { return sym(OUTPUT); }
+"end" { return sym(END); }
+"if" { return sym(IF); }
+"then" { return sym(THEN); }
+"else" { return sym(ELSE); }
+"fi" { return sym(FI); }
+[a-z]+ { symtab.enter(yytext(),new SymtabEntry(yytext()));
+ return sym(ID,yytext()); }
+[0-9]+ { return sym(NUMBER,yytext()); }
+"," { return sym(COMMA); }
+"(" { return sym(LPAR); }
+")" { return sym(RPAR); }
+"=" { return sym(EQ); }
+"-" { return sym(MINUS); }
+"+" { return sym(PLUS); }
+"*" { return sym(TIMES); }
+"/" { return sym(DIV); }
+"<" { return sym(LE); }
+"<=" { return sym(LEQ); }
+[\ \t\b\f\r\n]+ { /* eat whitespace */ }
+"//"[^\n]* { /* one-line comment */ }
+. { throw new Error("Unexpected character ["+yytext()+"]"); }
Index: /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/examples/java/JavaParser.java
===================================================================
--- /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/examples/java/JavaParser.java (revision 25585)
+++ /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/examples/java/JavaParser.java (revision 25585)
@@ -0,0 +1,47 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright (C) 1998-2009 Gerwin Klein *
+ * All rights reserved. *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License. See the file *
+ * COPYRIGHT for more information. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License along *
+ * with this program; if not, write to the Free Software Foundation, Inc., *
+ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *
+ * *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+import java.io.*;
+
+
+/**
+ * Simple test driver for the java parser. Just runs it on some
+ * input files, gives no useful output.
+ */
+public class JavaParser {
+
+ public static void main(String argv[]) {
+
+ for (int i = 0; i < argv.length; i++) {
+ try {
+ System.out.println("Parsing ["+argv[i]+"]");
+ Scanner s = new Scanner(new UnicodeEscapes(new FileReader(argv[i])));
+ parser p = new parser(s);
+ p.parse();
+
+ System.out.println("No errors.");
+ }
+ catch (Exception e) {
+ e.printStackTrace(System.out);
+ System.exit(1);
+ }
+ }
+ }
+
+}
Index: /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/examples/java/JavaSymbol.java
===================================================================
--- /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/examples/java/JavaSymbol.java (revision 25585)
+++ /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/examples/java/JavaSymbol.java (revision 25585)
@@ -0,0 +1,31 @@
+
+public class JavaSymbol extends java_cup.runtime.Symbol {
+ private int line;
+ private int column;
+
+ public JavaSymbol(int type, int line, int column) {
+ this(type, line, column, -1, -1, null);
+ }
+
+ public JavaSymbol(int type, int line, int column, Object value) {
+ this(type, line, column, -1, -1, value);
+ }
+
+ public JavaSymbol(int type, int line, int column, int left, int right, Object value) {
+ super(type, left, right, value);
+ this.line = line;
+ this.column = column;
+ }
+
+ public int getLine() {
+ return line;
+ }
+
+ public int getColumn() {
+ return column;
+ }
+
+ public String toString() {
+ return "line "+line+", column "+column+", sym: "+sym+(value == null ? "" : (", value: '"+value+"'"));
+ }
+}
Index: /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/examples/java/Makefile
===================================================================
--- /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/examples/java/Makefile (revision 25585)
+++ /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/examples/java/Makefile (revision 25585)
@@ -0,0 +1,48 @@
+# You need CUP v0.10j (or newer) for this makefile to work (for java12.cup)
+#
+# CUP classes should be included in CLASSPATH
+
+CUP = java java_cup.Main -interface <
+JFLEX = jflex
+JAVA = java
+JAVAC = javac
+#JAVAC = jikes
+JAVACFLAGS =
+
+# --------------------------------------------------
+
+all: test
+
+test: lexer-output.txt
+ @(diff lexer-output.txt lexer-output.good && echo "Test OK!") || echo "Test failed!"
+
+lexer-output.txt: compile
+ $(JAVA) TestLexer TestLexer.java > lexer-output.txt
+
+
+compile: scanner parser unicode
+ $(JAVAC) $(JAVACFLAGS) JavaParser.java TestLexer.java
+
+parser: parser.java
+
+parser.java: java12.cup
+ $(CUP) java12.cup
+
+scanner: Scanner.java
+
+Scanner.java: java.flex
+ $(JFLEX) java.flex
+
+unicode: UnicodeEscapes.java
+
+UnicodeEscapes.java: unicode.flex
+ $(JFLEX) unicode.flex
+
+clean:
+ rm -f *.class
+ rm -f *~
+ rm -f Scanner.java
+ rm -f parser.java
+ rm -f sym.java
+ rm -f UnicodeEscapes.java
+ rm -f lexer-output.txt
Index: /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/examples/java/README
===================================================================
--- /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/examples/java/README (revision 25585)
+++ /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/examples/java/README (revision 25585)
@@ -0,0 +1,41 @@
+This directory contains a scanner and parser for the Java programming language.
+
+You need the parser generator CUP v0.10j (or newer) for the parser to work.
+Use the Makefile to generate the lexer and parser, or type:
+
+jflex unicode.flex
+jflex java.flex
+java java_cup.Main -interface < java12.cup
+javac JavaParser.java TestLexer.java
+
+
+The parser can be tested with:
+java JavaParser
+
+The scanner (without parser attached) can be test with:
+java TestLexer
+
+
+files:
+
+unicode.flex
+ JFlex specification for the Unicode preprocessing phase
+ (see section 3.3 of the Java Language Specification).
+ Demonstrates how to implement a FilterReader with JFlex.
+
+java.flex
+ JFlex specification for the "real" Java 1.2 lexer.
+
+java12.cup
+ CUP specification for the Java 1.2 parser
+ Copyright (C) 1998 by C. Scott Ananian
+ (with small modifications to interface with the Lexer)
+
+JavaParser.java
+ a simple main class to run the parser (no other useful output though)
+
+TestLexer.java
+ a simple test driver for the scanner, produces debug output
+
+lexer-output.good
+ lexer output for input file TestLexer.java for testing
Index: /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/examples/java/TestLexer.java
===================================================================
--- /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/examples/java/TestLexer.java (revision 25585)
+++ /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/examples/java/TestLexer.java (revision 25585)
@@ -0,0 +1,61 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright (C) 2004-2009 Gerwin Klein *
+ * All rights reserved. *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License. See the file *
+ * COPYRIGHT for more information. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License along *
+ * with this program; if not, write to the Free Software Foundation, Inc., *
+ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *
+ * *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+import java.io.*;
+import java_cup.runtime.Symbol;
+
+
+/**
+ * Simple test driver for the java lexer. Just runs it on some
+ * input files and produces debug output. Needs symbol class from
+ * parser.
+ */
+public class TestLexer {
+
+ /** some numerals to for lexer testing */
+ int intDec = 37;
+ long longDec = 37l;
+ int intHex = 0x0001;
+ long longHex = 0xFFFFl;
+ int intOct = 0377;
+ long longOc = 007l;
+ int smallest = -2147483648;
+
+ public static void main(String argv[]) {
+
+ for (int i = 0; i < argv.length; i++) {
+ try {
+ System.out.println("Lexing ["+argv[i]+"]");
+ Scanner scanner = new Scanner(new UnicodeEscapes(new FileReader(argv[i])));
+
+ Symbol s;
+ do {
+ s = scanner.debug_next_token();
+ System.out.println("token: "+s);
+ } while (s.sym != sym.EOF);
+
+ System.out.println("No errors.");
+ }
+ catch (Exception e) {
+ e.printStackTrace(System.out);
+ System.exit(1);
+ }
+ }
+ }
+}
Index: /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/examples/java/build.xml
===================================================================
--- /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/examples/java/build.xml (revision 25585)
+++ /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/examples/java/build.xml (revision 25585)
@@ -0,0 +1,46 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Index: /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/examples/java/java.flex
===================================================================
--- /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/examples/java/java.flex (revision 25585)
+++ /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/examples/java/java.flex (revision 25585)
@@ -0,0 +1,316 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright (C) 1998-2009 Gerwin Klein *
+ * All rights reserved. *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License. See the file *
+ * COPYRIGHT for more information. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License along *
+ * with this program; if not, write to the Free Software Foundation, Inc., *
+ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *
+ * *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+/* Java 1.2 language lexer specification */
+
+/* Use together with unicode.flex for Unicode preprocesssing */
+/* and java12.cup for a Java 1.2 parser */
+
+/* Note that this lexer specification is not tuned for speed.
+ It is in fact quite slow on integer and floating point literals,
+ because the input is read twice and the methods used to parse
+ the numbers are not very fast.
+ For a production quality application (e.g. a Java compiler)
+ this could be optimized */
+
+
+import java_cup.runtime.*;
+
+%%
+
+%public
+%class Scanner
+%implements sym
+
+%unicode
+
+%line
+%column
+
+%cup
+%cupdebug
+
+%{
+ StringBuffer string = new StringBuffer();
+
+ private Symbol symbol(int type) {
+ return new JavaSymbol(type, yyline+1, yycolumn+1);
+ }
+
+ private Symbol symbol(int type, Object value) {
+ return new JavaSymbol(type, yyline+1, yycolumn+1, value);
+ }
+
+ /**
+ * assumes correct representation of a long value for
+ * specified radix in scanner buffer from start
+ * to end
+ */
+ private long parseLong(int start, int end, int radix) {
+ long result = 0;
+ long digit;
+
+ for (int i = start; i < end; i++) {
+ digit = Character.digit(yycharat(i),radix);
+ result*= radix;
+ result+= digit;
+ }
+
+ return result;
+ }
+%}
+
+/* main character classes */
+LineTerminator = \r|\n|\r\n
+InputCharacter = [^\r\n]
+
+WhiteSpace = {LineTerminator} | [ \t\f]
+
+/* comments */
+Comment = {TraditionalComment} | {EndOfLineComment} |
+ {DocumentationComment}
+
+TraditionalComment = "/*" [^*] ~"*/" | "/*" "*"+ "/"
+EndOfLineComment = "//" {InputCharacter}* {LineTerminator}?
+DocumentationComment = "/*" "*"+ [^/*] ~"*/"
+
+/* identifiers */
+Identifier = [:jletter:][:jletterdigit:]*
+
+/* integer literals */
+DecIntegerLiteral = 0 | [1-9][0-9]*
+DecLongLiteral = {DecIntegerLiteral} [lL]
+
+HexIntegerLiteral = 0 [xX] 0* {HexDigit} {1,8}
+HexLongLiteral = 0 [xX] 0* {HexDigit} {1,16} [lL]
+HexDigit = [0-9a-fA-F]
+
+OctIntegerLiteral = 0+ [1-3]? {OctDigit} {1,15}
+OctLongLiteral = 0+ 1? {OctDigit} {1,21} [lL]
+OctDigit = [0-7]
+
+/* floating point literals */
+FloatLiteral = ({FLit1}|{FLit2}|{FLit3}) {Exponent}? [fF]
+DoubleLiteral = ({FLit1}|{FLit2}|{FLit3}) {Exponent}?
+
+FLit1 = [0-9]+ \. [0-9]*
+FLit2 = \. [0-9]+
+FLit3 = [0-9]+
+Exponent = [eE] [+-]? [0-9]+
+
+/* string and character literals */
+StringCharacter = [^\r\n\"\\]
+SingleCharacter = [^\r\n\'\\]
+
+%state STRING, CHARLITERAL
+
+%%
+
+ {
+
+ /* keywords */
+ "abstract" { return symbol(ABSTRACT); }
+ "boolean" { return symbol(BOOLEAN); }
+ "break" { return symbol(BREAK); }
+ "byte" { return symbol(BYTE); }
+ "case" { return symbol(CASE); }
+ "catch" { return symbol(CATCH); }
+ "char" { return symbol(CHAR); }
+ "class" { return symbol(CLASS); }
+ "const" { return symbol(CONST); }
+ "continue" { return symbol(CONTINUE); }
+ "do" { return symbol(DO); }
+ "double" { return symbol(DOUBLE); }
+ "else" { return symbol(ELSE); }
+ "extends" { return symbol(EXTENDS); }
+ "final" { return symbol(FINAL); }
+ "finally" { return symbol(FINALLY); }
+ "float" { return symbol(FLOAT); }
+ "for" { return symbol(FOR); }
+ "default" { return symbol(DEFAULT); }
+ "implements" { return symbol(IMPLEMENTS); }
+ "import" { return symbol(IMPORT); }
+ "instanceof" { return symbol(INSTANCEOF); }
+ "int" { return symbol(INT); }
+ "interface" { return symbol(INTERFACE); }
+ "long" { return symbol(LONG); }
+ "native" { return symbol(NATIVE); }
+ "new" { return symbol(NEW); }
+ "goto" { return symbol(GOTO); }
+ "if" { return symbol(IF); }
+ "public" { return symbol(PUBLIC); }
+ "short" { return symbol(SHORT); }
+ "super" { return symbol(SUPER); }
+ "switch" { return symbol(SWITCH); }
+ "synchronized" { return symbol(SYNCHRONIZED); }
+ "package" { return symbol(PACKAGE); }
+ "private" { return symbol(PRIVATE); }
+ "protected" { return symbol(PROTECTED); }
+ "transient" { return symbol(TRANSIENT); }
+ "return" { return symbol(RETURN); }
+ "void" { return symbol(VOID); }
+ "static" { return symbol(STATIC); }
+ "while" { return symbol(WHILE); }
+ "this" { return symbol(THIS); }
+ "throw" { return symbol(THROW); }
+ "throws" { return symbol(THROWS); }
+ "try" { return symbol(TRY); }
+ "volatile" { return symbol(VOLATILE); }
+ "strictfp" { return symbol(STRICTFP); }
+
+ /* boolean literals */
+ "true" { return symbol(BOOLEAN_LITERAL, new Boolean(true)); }
+ "false" { return symbol(BOOLEAN_LITERAL, new Boolean(false)); }
+
+ /* null literal */
+ "null" { return symbol(NULL_LITERAL); }
+
+
+ /* separators */
+ "(" { return symbol(LPAREN); }
+ ")" { return symbol(RPAREN); }
+ "{" { return symbol(LBRACE); }
+ "}" { return symbol(RBRACE); }
+ "[" { return symbol(LBRACK); }
+ "]" { return symbol(RBRACK); }
+ ";" { return symbol(SEMICOLON); }
+ "," { return symbol(COMMA); }
+ "." { return symbol(DOT); }
+
+ /* operators */
+ "=" { return symbol(EQ); }
+ ">" { return symbol(GT); }
+ "<" { return symbol(LT); }
+ "!" { return symbol(NOT); }
+ "~" { return symbol(COMP); }
+ "?" { return symbol(QUESTION); }
+ ":" { return symbol(COLON); }
+ "==" { return symbol(EQEQ); }
+ "<=" { return symbol(LTEQ); }
+ ">=" { return symbol(GTEQ); }
+ "!=" { return symbol(NOTEQ); }
+ "&&" { return symbol(ANDAND); }
+ "||" { return symbol(OROR); }
+ "++" { return symbol(PLUSPLUS); }
+ "--" { return symbol(MINUSMINUS); }
+ "+" { return symbol(PLUS); }
+ "-" { return symbol(MINUS); }
+ "*" { return symbol(MULT); }
+ "/" { return symbol(DIV); }
+ "&" { return symbol(AND); }
+ "|" { return symbol(OR); }
+ "^" { return symbol(XOR); }
+ "%" { return symbol(MOD); }
+ "<<" { return symbol(LSHIFT); }
+ ">>" { return symbol(RSHIFT); }
+ ">>>" { return symbol(URSHIFT); }
+ "+=" { return symbol(PLUSEQ); }
+ "-=" { return symbol(MINUSEQ); }
+ "*=" { return symbol(MULTEQ); }
+ "/=" { return symbol(DIVEQ); }
+ "&=" { return symbol(ANDEQ); }
+ "|=" { return symbol(OREQ); }
+ "^=" { return symbol(XOREQ); }
+ "%=" { return symbol(MODEQ); }
+ "<<=" { return symbol(LSHIFTEQ); }
+ ">>=" { return symbol(RSHIFTEQ); }
+ ">>>=" { return symbol(URSHIFTEQ); }
+
+ /* string literal */
+ \" { yybegin(STRING); string.setLength(0); }
+
+ /* character literal */
+ \' { yybegin(CHARLITERAL); }
+
+ /* numeric literals */
+
+ /* This is matched together with the minus, because the number is too big to
+ be represented by a positive integer. */
+ "-2147483648" { return symbol(INTEGER_LITERAL, new Integer(Integer.MIN_VALUE)); }
+
+ {DecIntegerLiteral} { return symbol(INTEGER_LITERAL, new Integer(yytext())); }
+ {DecLongLiteral} { return symbol(INTEGER_LITERAL, new Long(yytext().substring(0,yylength()-1))); }
+
+ {HexIntegerLiteral} { return symbol(INTEGER_LITERAL, new Integer((int) parseLong(2, yylength(), 16))); }
+ {HexLongLiteral} { return symbol(INTEGER_LITERAL, new Long(parseLong(2, yylength()-1, 16))); }
+
+ {OctIntegerLiteral} { return symbol(INTEGER_LITERAL, new Integer((int) parseLong(0, yylength(), 8))); }
+ {OctLongLiteral} { return symbol(INTEGER_LITERAL, new Long(parseLong(0, yylength()-1, 8))); }
+
+ {FloatLiteral} { return symbol(FLOATING_POINT_LITERAL, new Float(yytext().substring(0,yylength()-1))); }
+ {DoubleLiteral} { return symbol(FLOATING_POINT_LITERAL, new Double(yytext())); }
+ {DoubleLiteral}[dD] { return symbol(FLOATING_POINT_LITERAL, new Double(yytext().substring(0,yylength()-1))); }
+
+ /* comments */
+ {Comment} { /* ignore */ }
+
+ /* whitespace */
+ {WhiteSpace} { /* ignore */ }
+
+ /* identifiers */
+ {Identifier} { return symbol(IDENTIFIER, yytext()); }
+}
+
+ {
+ \" { yybegin(YYINITIAL); return symbol(STRING_LITERAL, string.toString()); }
+
+ {StringCharacter}+ { string.append( yytext() ); }
+
+ /* escape sequences */
+ "\\b" { string.append( '\b' ); }
+ "\\t" { string.append( '\t' ); }
+ "\\n" { string.append( '\n' ); }
+ "\\f" { string.append( '\f' ); }
+ "\\r" { string.append( '\r' ); }
+ "\\\"" { string.append( '\"' ); }
+ "\\'" { string.append( '\'' ); }
+ "\\\\" { string.append( '\\' ); }
+ \\[0-3]?{OctDigit}?{OctDigit} { char val = (char) Integer.parseInt(yytext().substring(1),8);
+ string.append( val ); }
+
+ /* error cases */
+ \\. { throw new RuntimeException("Illegal escape sequence \""+yytext()+"\""); }
+ {LineTerminator} { throw new RuntimeException("Unterminated string at end of line"); }
+}
+
+ {
+ {SingleCharacter}\' { yybegin(YYINITIAL); return symbol(CHARACTER_LITERAL, new Character(yytext().charAt(0))); }
+
+ /* escape sequences */
+ "\\b"\' { yybegin(YYINITIAL); return symbol(CHARACTER_LITERAL, new Character('\b'));}
+ "\\t"\' { yybegin(YYINITIAL); return symbol(CHARACTER_LITERAL, new Character('\t'));}
+ "\\n"\' { yybegin(YYINITIAL); return symbol(CHARACTER_LITERAL, new Character('\n'));}
+ "\\f"\' { yybegin(YYINITIAL); return symbol(CHARACTER_LITERAL, new Character('\f'));}
+ "\\r"\' { yybegin(YYINITIAL); return symbol(CHARACTER_LITERAL, new Character('\r'));}
+ "\\\""\' { yybegin(YYINITIAL); return symbol(CHARACTER_LITERAL, new Character('\"'));}
+ "\\'"\' { yybegin(YYINITIAL); return symbol(CHARACTER_LITERAL, new Character('\''));}
+ "\\\\"\' { yybegin(YYINITIAL); return symbol(CHARACTER_LITERAL, new Character('\\')); }
+ \\[0-3]?{OctDigit}?{OctDigit}\' { yybegin(YYINITIAL);
+ int val = Integer.parseInt(yytext().substring(1,yylength()-1),8);
+ return symbol(CHARACTER_LITERAL, new Character((char)val)); }
+
+ /* error cases */
+ \\. { throw new RuntimeException("Illegal escape sequence \""+yytext()+"\""); }
+ {LineTerminator} { throw new RuntimeException("Unterminated character literal at end of line"); }
+}
+
+/* error fallback */
+.|\n { throw new RuntimeException("Illegal character \""+yytext()+
+ "\" at line "+yyline+", column "+yycolumn); }
+<> { return symbol(EOF); }
Index: /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/examples/java/java12.cup
===================================================================
--- /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/examples/java/java12.cup (revision 25585)
+++ /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/examples/java/java12.cup (revision 25585)
@@ -0,0 +1,885 @@
+import java_cup.runtime.*;
+
+
+/* August 1999 - modified by Gerwin Klein
+ to interface with JFlex scanners,
+ allows empty semicolon in class decls.
+
+ changed productions:
+
+ class_member_declaration ::=
+ field_declaration
+ | method_declaration
+ [..]
+ | interface_declaration
+ | SEMICOLON
+ ;
+
+ interface_member_declaration ::=
+ constant_declaration
+ | abstract_method_declaration
+ | class_declaration
+ | interface_declaration
+ | SEMICOLON
+ ;
+
+*/
+
+
+/* Java 1.2 parser for CUP.
+ * Copyright (C) 1998 C. Scott Ananian
+ * This program is released under the terms of the GPL; see the file
+ * COPYING for more details. There is NO WARRANTY on this code.
+ */
+
+/*
+JDK 1.2 Features added:
+ strictfp modifier.
+ explicit_constructor_invocation ::= ...
+ | primary DOT THIS LPAREN argument_list_opt RPAREN SEMICOLON ;
+ field_access ::= ...
+ | name DOT SUPER DOT IDENTIFIER ;
+ method_invocation ::= ...
+ | name DOT SUPER DOT IDENTIFIER LPAREN argument_list_opt RPAREN ;
+*/
+
+parser code {:
+ public void report_error(String message, Object info) {
+ StringBuffer m = new StringBuffer("Error ");
+
+ if (info instanceof java_cup.runtime.Symbol)
+ m.append( "("+info.toString()+")" );
+
+ m.append(" : "+message);
+
+ System.out.println(m);
+ }
+
+ public void report_fatal_error(String message, Object info) {
+ report_error(message, info);
+ throw new RuntimeException("Fatal Syntax Error");
+ }
+:};
+
+terminal BOOLEAN; // primitive_type
+terminal BYTE, SHORT, INT, LONG, CHAR; // integral_type
+terminal FLOAT, DOUBLE; // floating_point_type
+terminal LBRACK, RBRACK; // array_type
+terminal DOT; // qualified_name
+terminal SEMICOLON, MULT, COMMA, LBRACE, RBRACE, EQ, LPAREN, RPAREN, COLON;
+terminal PACKAGE; // package_declaration
+terminal IMPORT; // import_declaration
+terminal PUBLIC, PROTECTED, PRIVATE; // modifier
+terminal STATIC; // modifier
+terminal ABSTRACT, FINAL, NATIVE, SYNCHRONIZED, TRANSIENT, VOLATILE;
+terminal CLASS; // class_declaration
+terminal EXTENDS; // super
+terminal IMPLEMENTS; // interfaces
+terminal VOID; // method_header
+terminal THROWS; // throws
+terminal THIS, SUPER; // explicit_constructor_invocation
+terminal INTERFACE; // interface_declaration
+terminal IF, ELSE; // if_then_statement, if_then_else_statement
+terminal SWITCH; // switch_statement
+terminal CASE, DEFAULT; // switch_label
+terminal DO, WHILE; // while_statement, do_statement
+terminal FOR; // for_statement
+terminal BREAK; // break_statement
+terminal CONTINUE; // continue_statement
+terminal RETURN; // return_statement
+terminal THROW; // throw_statement
+terminal TRY; // try_statement
+terminal CATCH; // catch_clause
+terminal FINALLY; // finally
+terminal NEW; // class_instance_creation_expression
+terminal PLUSPLUS; // postincrement_expression
+terminal MINUSMINUS; // postdecrement_expression
+terminal PLUS, MINUS, COMP, NOT, DIV, MOD;
+terminal LSHIFT, RSHIFT, URSHIFT; // shift_expression
+terminal LT, GT, LTEQ, GTEQ, INSTANCEOF; // relational_expression
+terminal EQEQ, NOTEQ; // equality_expression
+terminal AND; // and_expression
+terminal XOR; // exclusive_or_expression
+terminal OR; // inclusive_or_expression
+terminal ANDAND; // conditional_and_expression
+terminal OROR; // conditional_or_expression
+terminal QUESTION; // conditional_expression
+terminal MULTEQ, DIVEQ, MODEQ, PLUSEQ, MINUSEQ; // assignment_operator
+terminal LSHIFTEQ, RSHIFTEQ, URSHIFTEQ; // assignment_operator
+terminal ANDEQ, XOREQ, OREQ; // assignment_operator
+
+terminal java.lang.Number INTEGER_LITERAL;
+terminal java.lang.Number FLOATING_POINT_LITERAL;
+terminal java.lang.Boolean BOOLEAN_LITERAL;
+terminal java.lang.Character CHARACTER_LITERAL;
+terminal java.lang.String STRING_LITERAL;
+terminal java.lang.String IDENTIFIER; // name
+terminal NULL_LITERAL;
+
+// strictfp keyword, new in Java 1.2
+terminal STRICTFP;
+
+// Reserved but unused:
+terminal CONST, GOTO;
+
+// 19.2) The Syntactic Grammar
+non terminal goal;
+// 19.3) Lexical Structure
+non terminal literal;
+// 19.4) Types, Values, and Variables
+non terminal type, primitive_type, numeric_type;
+non terminal integral_type, floating_point_type;
+non terminal reference_type;
+non terminal class_or_interface_type;
+non terminal class_type, interface_type;
+non terminal array_type;
+// 19.5) Names
+non terminal name, simple_name, qualified_name;
+// 19.6) Packages
+non terminal compilation_unit;
+non terminal package_declaration_opt, package_declaration;
+non terminal import_declarations_opt, import_declarations;
+non terminal type_declarations_opt, type_declarations;
+non terminal import_declaration;
+non terminal single_type_import_declaration;
+non terminal type_import_on_demand_declaration;
+non terminal type_declaration;
+// 19.7) Productions used only in the LALR(1) grammar
+non terminal modifiers_opt, modifiers, modifier;
+// 19.8.1) Class Declaration
+non terminal class_declaration, super_cl, super_opt;
+non terminal interfaces, interfaces_opt, interface_type_list;
+non terminal class_body;
+non terminal class_body_declarations, class_body_declarations_opt;
+non terminal class_body_declaration, class_member_declaration;
+// 19.8.2) Field Declarations
+non terminal field_declaration, variable_declarators, variable_declarator;
+non terminal variable_declarator_id, variable_initializer;
+// 19.8.3) Method Declarations
+non terminal method_declaration, method_header, method_declarator;
+non terminal formal_parameter_list_opt, formal_parameter_list;
+non terminal formal_parameter;
+non terminal throws_opt, throws;
+non terminal class_type_list, method_body;
+// 19.8.4) Static Initializers
+non terminal static_initializer;
+// 19.8.5) Constructor Declarations
+non terminal constructor_declaration, constructor_declarator;
+non terminal constructor_body;
+non terminal explicit_constructor_invocation;
+// 19.9.1) Interface Declarations
+non terminal interface_declaration;
+non terminal extends_interfaces_opt, extends_interfaces;
+non terminal interface_body;
+non terminal interface_member_declarations_opt, interface_member_declarations;
+non terminal interface_member_declaration, constant_declaration;
+non terminal abstract_method_declaration;
+// 19.10) Arrays
+non terminal array_initializer;
+non terminal variable_initializers;
+// 19.11) Blocks and Statements
+non terminal block;
+non terminal block_statements_opt, block_statements, block_statement;
+non terminal local_variable_declaration_statement, local_variable_declaration;
+non terminal statement, statement_no_short_if;
+non terminal statement_without_trailing_substatement;
+non terminal empty_statement;
+non terminal labeled_statement, labeled_statement_no_short_if;
+non terminal expression_statement, statement_expression;
+non terminal if_then_statement;
+non terminal if_then_else_statement, if_then_else_statement_no_short_if;
+non terminal switch_statement, switch_block;
+non terminal switch_block_statement_groups;
+non terminal switch_block_statement_group;
+non terminal switch_labels, switch_label;
+non terminal while_statement, while_statement_no_short_if;
+non terminal do_statement;
+non terminal for_statement, for_statement_no_short_if;
+non terminal for_init_opt, for_init;
+non terminal for_update_opt, for_update;
+non terminal statement_expression_list;
+non terminal identifier_opt;
+non terminal break_statement, continue_statement;
+non terminal return_statement, throw_statement;
+non terminal synchronized_statement, try_statement;
+non terminal catches_opt, catches, catch_clause;
+non terminal finally;
+// 19.12) Expressions
+non terminal primary, primary_no_new_array;
+non terminal class_instance_creation_expression;
+non terminal argument_list_opt, argument_list;
+non terminal array_creation_expression;
+non terminal dim_exprs, dim_expr, dims_opt, dims;
+non terminal field_access, method_invocation, array_access;
+non terminal postfix_expression;
+non terminal postincrement_expression, postdecrement_expression;
+non terminal unary_expression, unary_expression_not_plus_minus;
+non terminal preincrement_expression, predecrement_expression;
+non terminal cast_expression;
+non terminal multiplicative_expression, additive_expression;
+non terminal shift_expression, relational_expression, equality_expression;
+non terminal and_expression, exclusive_or_expression, inclusive_or_expression;
+non terminal conditional_and_expression, conditional_or_expression;
+non terminal conditional_expression, assignment_expression;
+non terminal assignment;
+non terminal left_hand_side;
+non terminal assignment_operator;
+non terminal expression_opt, expression;
+non terminal constant_expression;
+
+
+start with goal;
+
+// 19.2) The Syntactic Grammar
+goal ::= compilation_unit
+ ;
+
+// 19.3) Lexical Structure.
+literal ::= INTEGER_LITERAL
+ | FLOATING_POINT_LITERAL
+ | BOOLEAN_LITERAL
+ | CHARACTER_LITERAL
+ | STRING_LITERAL
+ | NULL_LITERAL
+ ;
+
+// 19.4) Types, Values, and Variables
+type ::= primitive_type
+ | reference_type
+ ;
+primitive_type ::=
+ numeric_type
+ | BOOLEAN
+ ;
+numeric_type::= integral_type
+ | floating_point_type
+ ;
+integral_type ::=
+ BYTE
+ | SHORT
+ | INT
+ | LONG
+ | CHAR
+ ;
+floating_point_type ::=
+ FLOAT
+ | DOUBLE
+ ;
+
+reference_type ::=
+ class_or_interface_type
+ | array_type
+ ;
+class_or_interface_type ::= name;
+
+class_type ::= class_or_interface_type;
+interface_type ::= class_or_interface_type;
+
+array_type ::= primitive_type dims
+ | name dims
+ ;
+
+// 19.5) Names
+name ::= simple_name
+ | qualified_name
+ ;
+simple_name ::= IDENTIFIER
+ ;
+qualified_name ::=
+ name DOT IDENTIFIER
+ ;
+
+// 19.6) Packages
+compilation_unit ::=
+ package_declaration_opt
+ import_declarations_opt
+ type_declarations_opt
+ ;
+package_declaration_opt ::= package_declaration | ;
+import_declarations_opt ::= import_declarations | ;
+type_declarations_opt ::= type_declarations | ;
+
+import_declarations ::=
+ import_declaration
+ | import_declarations import_declaration
+ ;
+type_declarations ::=
+ type_declaration
+ | type_declarations type_declaration
+ ;
+package_declaration ::=
+ PACKAGE name SEMICOLON
+ ;
+import_declaration ::=
+ single_type_import_declaration
+ | type_import_on_demand_declaration
+ ;
+single_type_import_declaration ::=
+ IMPORT name SEMICOLON
+ ;
+type_import_on_demand_declaration ::=
+ IMPORT name DOT MULT SEMICOLON
+ ;
+type_declaration ::=
+ class_declaration
+ | interface_declaration
+ | SEMICOLON
+ ;
+
+// 19.7) Productions used only in the LALR(1) grammar
+modifiers_opt::=
+ | modifiers
+ ;
+modifiers ::= modifier
+ | modifiers modifier
+ ;
+modifier ::= PUBLIC | PROTECTED | PRIVATE
+ | STATIC
+ | ABSTRACT | FINAL | NATIVE | SYNCHRONIZED | TRANSIENT | VOLATILE
+ | STRICTFP // note that semantic analysis must check that the
+ // context of the modifier allows strictfp.
+ ;
+
+// 19.8) Classes
+
+// 19.8.1) Class Declaration:
+class_declaration ::=
+ modifiers_opt CLASS IDENTIFIER super_opt interfaces_opt class_body
+ ;
+super_cl ::= EXTENDS class_type
+ ;
+super_opt ::=
+ | super_cl
+ ;
+interfaces ::= IMPLEMENTS interface_type_list
+ ;
+interfaces_opt::=
+ | interfaces
+ ;
+interface_type_list ::=
+ interface_type
+ | interface_type_list COMMA interface_type
+ ;
+class_body ::= LBRACE class_body_declarations_opt RBRACE
+ ;
+class_body_declarations_opt ::=
+ | class_body_declarations ;
+class_body_declarations ::=
+ class_body_declaration
+ | class_body_declarations class_body_declaration
+ ;
+class_body_declaration ::=
+ class_member_declaration
+ | static_initializer
+ | constructor_declaration
+ | block
+ ;
+class_member_declaration ::=
+ field_declaration
+ | method_declaration
+ /* repeat the prod for 'class_declaration' here: */
+ | modifiers_opt CLASS IDENTIFIER super_opt interfaces_opt class_body
+ | interface_declaration
+ | SEMICOLON
+ ;
+
+// 19.8.2) Field Declarations
+field_declaration ::=
+ modifiers_opt type variable_declarators SEMICOLON
+ ;
+variable_declarators ::=
+ variable_declarator
+ | variable_declarators COMMA variable_declarator
+ ;
+variable_declarator ::=
+ variable_declarator_id
+ | variable_declarator_id EQ variable_initializer
+ ;
+variable_declarator_id ::=
+ IDENTIFIER
+ | variable_declarator_id LBRACK RBRACK
+ ;
+variable_initializer ::=
+ expression
+ | array_initializer
+ ;
+
+// 19.8.3) Method Declarations
+method_declaration ::=
+ method_header method_body
+ ;
+method_header ::=
+ modifiers_opt type method_declarator throws_opt
+ | modifiers_opt VOID method_declarator throws_opt
+ ;
+method_declarator ::=
+ IDENTIFIER LPAREN formal_parameter_list_opt RPAREN
+ | method_declarator LBRACK RBRACK // deprecated
+ // be careful; the above production also allows 'void foo() []'
+ ;
+formal_parameter_list_opt ::=
+ | formal_parameter_list
+ ;
+formal_parameter_list ::=
+ formal_parameter
+ | formal_parameter_list COMMA formal_parameter
+ ;
+formal_parameter ::=
+ type variable_declarator_id
+ | FINAL type variable_declarator_id
+ ;
+throws_opt ::=
+ | throws
+ ;
+throws ::= THROWS class_type_list
+ ;
+class_type_list ::=
+ class_type
+ | class_type_list COMMA class_type
+ ;
+method_body ::= block
+ | SEMICOLON
+ ;
+
+// 19.8.4) Static Initializers
+static_initializer ::=
+ STATIC block
+ ;
+
+// 19.8.5) Constructor Declarations
+constructor_declaration ::=
+ modifiers_opt constructor_declarator throws_opt
+ constructor_body
+ ;
+constructor_declarator ::=
+ simple_name LPAREN formal_parameter_list_opt RPAREN
+ ;
+constructor_body ::=
+ LBRACE explicit_constructor_invocation
+ block_statements RBRACE
+ | LBRACE explicit_constructor_invocation RBRACE
+ | LBRACE block_statements RBRACE
+ | LBRACE RBRACE
+ ;
+explicit_constructor_invocation ::=
+ THIS LPAREN argument_list_opt RPAREN SEMICOLON
+ | SUPER LPAREN argument_list_opt RPAREN SEMICOLON
+ | primary DOT THIS LPAREN argument_list_opt RPAREN SEMICOLON
+ | primary DOT SUPER LPAREN argument_list_opt RPAREN SEMICOLON
+ ;
+
+// 19.9) Interfaces
+
+// 19.9.1) Interface Declarations
+interface_declaration ::=
+ modifiers_opt INTERFACE IDENTIFIER extends_interfaces_opt
+ interface_body
+ ;
+extends_interfaces_opt ::=
+ | extends_interfaces
+ ;
+extends_interfaces ::=
+ EXTENDS interface_type
+ | extends_interfaces COMMA interface_type
+ ;
+interface_body ::=
+ LBRACE interface_member_declarations_opt RBRACE
+ ;
+interface_member_declarations_opt ::=
+ | interface_member_declarations
+ ;
+interface_member_declarations ::=
+ interface_member_declaration
+ | interface_member_declarations interface_member_declaration
+ ;
+interface_member_declaration ::=
+ constant_declaration
+ | abstract_method_declaration
+ | class_declaration
+ | interface_declaration
+ | SEMICOLON
+ ;
+constant_declaration ::=
+ field_declaration
+ ;
+abstract_method_declaration ::=
+ method_header SEMICOLON
+ ;
+
+// 19.10) Arrays
+array_initializer ::=
+ LBRACE variable_initializers COMMA RBRACE
+ | LBRACE variable_initializers RBRACE
+ | LBRACE COMMA RBRACE
+ | LBRACE RBRACE
+ ;
+variable_initializers ::=
+ variable_initializer
+ | variable_initializers COMMA variable_initializer
+ ;
+
+// 19.11) Blocks and Statements
+block ::= LBRACE block_statements_opt RBRACE
+ ;
+block_statements_opt ::=
+ | block_statements
+ ;
+block_statements ::=
+ block_statement
+ | block_statements block_statement
+ ;
+block_statement ::=
+ local_variable_declaration_statement
+ | statement
+ | class_declaration
+ | interface_declaration
+ ;
+local_variable_declaration_statement ::=
+ local_variable_declaration SEMICOLON
+ ;
+local_variable_declaration ::=
+ type variable_declarators
+ | FINAL type variable_declarators
+ ;
+statement ::= statement_without_trailing_substatement
+ | labeled_statement
+ | if_then_statement
+ | if_then_else_statement
+ | while_statement
+ | for_statement
+ ;
+statement_no_short_if ::=
+ statement_without_trailing_substatement
+ | labeled_statement_no_short_if
+ | if_then_else_statement_no_short_if
+ | while_statement_no_short_if
+ | for_statement_no_short_if
+ ;
+statement_without_trailing_substatement ::=
+ block
+ | empty_statement
+ | expression_statement
+ | switch_statement
+ | do_statement
+ | break_statement
+ | continue_statement
+ | return_statement
+ | synchronized_statement
+ | throw_statement
+ | try_statement
+ ;
+empty_statement ::=
+ SEMICOLON
+ ;
+labeled_statement ::=
+ IDENTIFIER COLON statement
+ ;
+labeled_statement_no_short_if ::=
+ IDENTIFIER COLON statement_no_short_if
+ ;
+expression_statement ::=
+ statement_expression SEMICOLON
+ ;
+statement_expression ::=
+ assignment
+ | preincrement_expression
+ | predecrement_expression
+ | postincrement_expression
+ | postdecrement_expression
+ | method_invocation
+ | class_instance_creation_expression
+ ;
+if_then_statement ::=
+ IF LPAREN expression RPAREN statement
+ ;
+if_then_else_statement ::=
+ IF LPAREN expression RPAREN statement_no_short_if
+ ELSE statement
+ ;
+if_then_else_statement_no_short_if ::=
+ IF LPAREN expression RPAREN statement_no_short_if
+ ELSE statement_no_short_if
+ ;
+switch_statement ::=
+ SWITCH LPAREN expression RPAREN switch_block
+ ;
+switch_block ::=
+ LBRACE switch_block_statement_groups switch_labels RBRACE
+ | LBRACE switch_block_statement_groups RBRACE
+ | LBRACE switch_labels RBRACE
+ | LBRACE RBRACE
+ ;
+switch_block_statement_groups ::=
+ switch_block_statement_group
+ | switch_block_statement_groups switch_block_statement_group
+ ;
+switch_block_statement_group ::=
+ switch_labels block_statements
+ ;
+switch_labels ::=
+ switch_label
+ | switch_labels switch_label
+ ;
+switch_label ::=
+ CASE constant_expression COLON
+ | DEFAULT COLON
+ ;
+
+while_statement ::=
+ WHILE LPAREN expression RPAREN statement
+ ;
+while_statement_no_short_if ::=
+ WHILE LPAREN expression RPAREN statement_no_short_if
+ ;
+do_statement ::=
+ DO statement WHILE LPAREN expression RPAREN SEMICOLON
+ ;
+for_statement ::=
+ FOR LPAREN for_init_opt SEMICOLON expression_opt SEMICOLON
+ for_update_opt RPAREN statement
+ ;
+for_statement_no_short_if ::=
+ FOR LPAREN for_init_opt SEMICOLON expression_opt SEMICOLON
+ for_update_opt RPAREN statement_no_short_if
+ ;
+for_init_opt ::=
+ | for_init
+ ;
+for_init ::= statement_expression_list
+ | local_variable_declaration
+ ;
+for_update_opt ::=
+ | for_update
+ ;
+for_update ::= statement_expression_list
+ ;
+statement_expression_list ::=
+ statement_expression
+ | statement_expression_list COMMA statement_expression
+ ;
+
+identifier_opt ::=
+ | IDENTIFIER
+ ;
+
+break_statement ::=
+ BREAK identifier_opt SEMICOLON
+ ;
+
+continue_statement ::=
+ CONTINUE identifier_opt SEMICOLON
+ ;
+return_statement ::=
+ RETURN expression_opt SEMICOLON
+ ;
+throw_statement ::=
+ THROW expression SEMICOLON
+ ;
+synchronized_statement ::=
+ SYNCHRONIZED LPAREN expression RPAREN block
+ ;
+try_statement ::=
+ TRY block catches
+ | TRY block catches_opt finally
+ ;
+catches_opt ::=
+ | catches
+ ;
+catches ::= catch_clause
+ | catches catch_clause
+ ;
+catch_clause ::=
+ CATCH LPAREN formal_parameter RPAREN block
+ ;
+finally ::= FINALLY block
+ ;
+
+// 19.12) Expressions
+primary ::= primary_no_new_array
+ | array_creation_expression
+ ;
+primary_no_new_array ::=
+ literal
+ | THIS
+ | LPAREN expression RPAREN
+ | class_instance_creation_expression
+ | field_access
+ | method_invocation
+ | array_access
+ | primitive_type DOT CLASS
+ | VOID DOT CLASS
+ | array_type DOT CLASS
+ | name DOT CLASS
+ | name DOT THIS
+ ;
+class_instance_creation_expression ::=
+ NEW class_type LPAREN argument_list_opt RPAREN
+ | NEW class_type LPAREN argument_list_opt RPAREN class_body
+ | primary DOT NEW IDENTIFIER
+ LPAREN argument_list_opt RPAREN
+ | primary DOT NEW IDENTIFIER
+ LPAREN argument_list_opt RPAREN class_body
+ ;
+argument_list_opt ::=
+ | argument_list
+ ;
+argument_list ::=
+ expression
+ | argument_list COMMA expression
+ ;
+array_creation_expression ::=
+ NEW primitive_type dim_exprs dims_opt
+ | NEW class_or_interface_type dim_exprs dims_opt
+ | NEW primitive_type dims array_initializer
+ | NEW class_or_interface_type dims array_initializer
+ ;
+dim_exprs ::= dim_expr
+ | dim_exprs dim_expr
+ ;
+dim_expr ::= LBRACK expression RBRACK
+ ;
+dims_opt ::=
+ | dims
+ ;
+dims ::= LBRACK RBRACK
+ | dims LBRACK RBRACK
+ ;
+field_access ::=
+ primary DOT IDENTIFIER
+ | SUPER DOT IDENTIFIER
+ | name DOT SUPER DOT IDENTIFIER
+ ;
+method_invocation ::=
+ name LPAREN argument_list_opt RPAREN
+ | primary DOT IDENTIFIER LPAREN argument_list_opt RPAREN
+ | SUPER DOT IDENTIFIER LPAREN argument_list_opt RPAREN
+ | name DOT SUPER DOT IDENTIFIER LPAREN argument_list_opt RPAREN
+ ;
+array_access ::=
+ name LBRACK expression RBRACK
+ | primary_no_new_array LBRACK expression RBRACK
+ ;
+postfix_expression ::=
+ primary
+ | name
+ | postincrement_expression
+ | postdecrement_expression
+ ;
+postincrement_expression ::=
+ postfix_expression PLUSPLUS
+ ;
+postdecrement_expression ::=
+ postfix_expression MINUSMINUS
+ ;
+unary_expression ::=
+ preincrement_expression
+ | predecrement_expression
+ | PLUS unary_expression
+ | MINUS unary_expression
+ | unary_expression_not_plus_minus
+ ;
+preincrement_expression ::=
+ PLUSPLUS unary_expression
+ ;
+predecrement_expression ::=
+ MINUSMINUS unary_expression
+ ;
+unary_expression_not_plus_minus ::=
+ postfix_expression
+ | COMP unary_expression
+ | NOT unary_expression
+ | cast_expression
+ ;
+cast_expression ::=
+ LPAREN primitive_type dims_opt RPAREN unary_expression
+ | LPAREN expression RPAREN unary_expression_not_plus_minus
+ | LPAREN name dims RPAREN unary_expression_not_plus_minus
+ ;
+multiplicative_expression ::=
+ unary_expression
+ | multiplicative_expression MULT unary_expression
+ | multiplicative_expression DIV unary_expression
+ | multiplicative_expression MOD unary_expression
+ ;
+additive_expression ::=
+ multiplicative_expression
+ | additive_expression PLUS multiplicative_expression
+ | additive_expression MINUS multiplicative_expression
+ ;
+shift_expression ::=
+ additive_expression
+ | shift_expression LSHIFT additive_expression
+ | shift_expression RSHIFT additive_expression
+ | shift_expression URSHIFT additive_expression
+ ;
+relational_expression ::=
+ shift_expression
+ | relational_expression LT shift_expression
+ | relational_expression GT shift_expression
+ | relational_expression LTEQ shift_expression
+ | relational_expression GTEQ shift_expression
+ | relational_expression INSTANCEOF reference_type
+ ;
+equality_expression ::=
+ relational_expression
+ | equality_expression EQEQ relational_expression
+ | equality_expression NOTEQ relational_expression
+ ;
+and_expression ::=
+ equality_expression
+ | and_expression AND equality_expression
+ ;
+exclusive_or_expression ::=
+ and_expression
+ | exclusive_or_expression XOR and_expression
+ ;
+inclusive_or_expression ::=
+ exclusive_or_expression
+ | inclusive_or_expression OR exclusive_or_expression
+ ;
+conditional_and_expression ::=
+ inclusive_or_expression
+ | conditional_and_expression ANDAND inclusive_or_expression
+ ;
+conditional_or_expression ::=
+ conditional_and_expression
+ | conditional_or_expression OROR conditional_and_expression
+ ;
+conditional_expression ::=
+ conditional_or_expression
+ | conditional_or_expression QUESTION expression
+ COLON conditional_expression
+ ;
+assignment_expression ::=
+ conditional_expression
+ | assignment
+ ;
+assignment ::= left_hand_side assignment_operator assignment_expression
+ ;
+left_hand_side ::=
+ name
+ | field_access
+ | array_access
+ ;
+assignment_operator ::=
+ EQ
+ | MULTEQ
+ | DIVEQ
+ | MODEQ
+ | PLUSEQ
+ | MINUSEQ
+ | LSHIFTEQ
+ | RSHIFTEQ
+ | URSHIFTEQ
+ | ANDEQ
+ | XOREQ
+ | OREQ
+ ;
+expression_opt ::=
+ | expression
+ ;
+expression ::= assignment_expression
+ ;
+constant_expression ::=
+ expression
+ ;
Index: /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/examples/java/lexer-output.good
===================================================================
--- /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/examples/java/lexer-output.good (revision 25585)
+++ /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/examples/java/lexer-output.good (revision 25585)
@@ -0,0 +1,386 @@
+Lexing [TestLexer.java]
+line:20 col:1 --import--IMPORT--
+token: line 20, column 1, sym: 23
+line:20 col:8 --java--IDENTIFIER--
+token: line 20, column 8, sym: 98, value: 'java'
+line:20 col:12 --.--DOT--
+token: line 20, column 12, sym: 12
+line:20 col:13 --io--IDENTIFIER--
+token: line 20, column 13, sym: 98, value: 'io'
+line:20 col:15 --.--DOT--
+token: line 20, column 15, sym: 12
+line:20 col:16 --*--MULT--
+token: line 20, column 16, sym: 14
+line:20 col:17 --;--SEMICOLON--
+token: line 20, column 17, sym: 13
+line:21 col:1 --import--IMPORT--
+token: line 21, column 1, sym: 23
+line:21 col:8 --java_cup--IDENTIFIER--
+token: line 21, column 8, sym: 98, value: 'java_cup'
+line:21 col:16 --.--DOT--
+token: line 21, column 16, sym: 12
+line:21 col:17 --runtime--IDENTIFIER--
+token: line 21, column 17, sym: 98, value: 'runtime'
+line:21 col:24 --.--DOT--
+token: line 21, column 24, sym: 12
+line:21 col:25 --Symbol--IDENTIFIER--
+token: line 21, column 25, sym: 98, value: 'Symbol'
+line:21 col:31 --;--SEMICOLON--
+token: line 21, column 31, sym: 13
+line:29 col:1 --public--PUBLIC--
+token: line 29, column 1, sym: 24
+line:29 col:8 --class--CLASS--
+token: line 29, column 8, sym: 34
+line:29 col:14 --TestLexer--IDENTIFIER--
+token: line 29, column 14, sym: 98, value: 'TestLexer'
+line:29 col:24 --{--LBRACE--
+token: line 29, column 24, sym: 16
+line:32 col:3 --int--INT--
+token: line 32, column 3, sym: 5
+line:32 col:7 --intDec--IDENTIFIER--
+token: line 32, column 7, sym: 98, value: 'intDec'
+line:32 col:14 --=--EQ--
+token: line 32, column 14, sym: 18
+line:32 col:16 --37--INTEGER_LITERAL--
+token: line 32, column 16, sym: 93, value: '37'
+line:32 col:18 --;--SEMICOLON--
+token: line 32, column 18, sym: 13
+line:33 col:3 --long--LONG--
+token: line 33, column 3, sym: 6
+line:33 col:8 --longDec--IDENTIFIER--
+token: line 33, column 8, sym: 98, value: 'longDec'
+line:33 col:16 --=--EQ--
+token: line 33, column 16, sym: 18
+line:33 col:18 --37l--INTEGER_LITERAL--
+token: line 33, column 18, sym: 93, value: '37'
+line:33 col:21 --;--SEMICOLON--
+token: line 33, column 21, sym: 13
+line:34 col:3 --int--INT--
+token: line 34, column 3, sym: 5
+line:34 col:7 --intHex--IDENTIFIER--
+token: line 34, column 7, sym: 98, value: 'intHex'
+line:34 col:14 --=--EQ--
+token: line 34, column 14, sym: 18
+line:34 col:16 --0x0001--INTEGER_LITERAL--
+token: line 34, column 16, sym: 93, value: '1'
+line:34 col:22 --;--SEMICOLON--
+token: line 34, column 22, sym: 13
+line:35 col:3 --long--LONG--
+token: line 35, column 3, sym: 6
+line:35 col:8 --longHex--IDENTIFIER--
+token: line 35, column 8, sym: 98, value: 'longHex'
+line:35 col:16 --=--EQ--
+token: line 35, column 16, sym: 18
+line:35 col:18 --0xFFFFl--INTEGER_LITERAL--
+token: line 35, column 18, sym: 93, value: '65535'
+line:35 col:25 --;--SEMICOLON--
+token: line 35, column 25, sym: 13
+line:36 col:3 --int--INT--
+token: line 36, column 3, sym: 5
+line:36 col:7 --intOct--IDENTIFIER--
+token: line 36, column 7, sym: 98, value: 'intOct'
+line:36 col:14 --=--EQ--
+token: line 36, column 14, sym: 18
+line:36 col:16 --0377--INTEGER_LITERAL--
+token: line 36, column 16, sym: 93, value: '255'
+line:36 col:20 --;--SEMICOLON--
+token: line 36, column 20, sym: 13
+line:37 col:3 --long--LONG--
+token: line 37, column 3, sym: 6
+line:37 col:8 --longOc--IDENTIFIER--
+token: line 37, column 8, sym: 98, value: 'longOc'
+line:37 col:15 --=--EQ--
+token: line 37, column 15, sym: 18
+line:37 col:17 --007l--INTEGER_LITERAL--
+token: line 37, column 17, sym: 93, value: '7'
+line:37 col:21 --;--SEMICOLON--
+token: line 37, column 21, sym: 13
+line:38 col:3 --int--INT--
+token: line 38, column 3, sym: 5
+line:38 col:7 --smallest--IDENTIFIER--
+token: line 38, column 7, sym: 98, value: 'smallest'
+line:38 col:16 --=--EQ--
+token: line 38, column 16, sym: 18
+line:38 col:18 ---2147483648--INTEGER_LITERAL--
+token: line 38, column 18, sym: 93, value: '-2147483648'
+line:38 col:29 --;--SEMICOLON--
+token: line 38, column 29, sym: 13
+line:40 col:3 --public--PUBLIC--
+token: line 40, column 3, sym: 24
+line:40 col:10 --static--STATIC--
+token: line 40, column 10, sym: 27
+line:40 col:17 --void--VOID--
+token: line 40, column 17, sym: 37
+line:40 col:22 --main--IDENTIFIER--
+token: line 40, column 22, sym: 98, value: 'main'
+line:40 col:26 --(--LPAREN--
+token: line 40, column 26, sym: 19
+line:40 col:27 --String--IDENTIFIER--
+token: line 40, column 27, sym: 98, value: 'String'
+line:40 col:34 --argv--IDENTIFIER--
+token: line 40, column 34, sym: 98, value: 'argv'
+line:40 col:38 --[--LBRACK--
+token: line 40, column 38, sym: 10
+line:40 col:39 --]--RBRACK--
+token: line 40, column 39, sym: 11
+line:40 col:40 --)--RPAREN--
+token: line 40, column 40, sym: 20
+line:40 col:42 --{--LBRACE--
+token: line 40, column 42, sym: 16
+line:42 col:5 --for--FOR--
+token: line 42, column 5, sym: 49
+line:42 col:9 --(--LPAREN--
+token: line 42, column 9, sym: 19
+line:42 col:10 --int--INT--
+token: line 42, column 10, sym: 5
+line:42 col:14 --i--IDENTIFIER--
+token: line 42, column 14, sym: 98, value: 'i'
+line:42 col:16 --=--EQ--
+token: line 42, column 16, sym: 18
+line:42 col:18 --0--INTEGER_LITERAL--
+token: line 42, column 18, sym: 93, value: '0'
+line:42 col:19 --;--SEMICOLON--
+token: line 42, column 19, sym: 13
+line:42 col:21 --i--IDENTIFIER--
+token: line 42, column 21, sym: 98, value: 'i'
+line:42 col:23 --<--LT--
+token: line 42, column 23, sym: 69
+line:42 col:25 --argv--IDENTIFIER--
+token: line 42, column 25, sym: 98, value: 'argv'
+line:42 col:29 --.--DOT--
+token: line 42, column 29, sym: 12
+line:42 col:30 --length--IDENTIFIER--
+token: line 42, column 30, sym: 98, value: 'length'
+line:42 col:36 --;--SEMICOLON--
+token: line 42, column 36, sym: 13
+line:42 col:38 --i--IDENTIFIER--
+token: line 42, column 38, sym: 98, value: 'i'
+line:42 col:39 --++--PLUSPLUS--
+token: line 42, column 39, sym: 58
+line:42 col:41 --)--RPAREN--
+token: line 42, column 41, sym: 20
+line:42 col:43 --{--LBRACE--
+token: line 42, column 43, sym: 16
+line:43 col:7 --try--TRY--
+token: line 43, column 7, sym: 54
+line:43 col:11 --{--LBRACE--
+token: line 43, column 11, sym: 16
+line:44 col:9 --System--IDENTIFIER--
+token: line 44, column 9, sym: 98, value: 'System'
+line:44 col:15 --.--DOT--
+token: line 44, column 15, sym: 12
+line:44 col:16 --out--IDENTIFIER--
+token: line 44, column 16, sym: 98, value: 'out'
+line:44 col:19 --.--DOT--
+token: line 44, column 19, sym: 12
+line:44 col:20 --println--IDENTIFIER--
+token: line 44, column 20, sym: 98, value: 'println'
+line:44 col:27 --(--LPAREN--
+token: line 44, column 27, sym: 19
+line:44 col:37 --"--STRING_LITERAL--
+token: line 44, column 37, sym: 97, value: 'Lexing ['
+line:44 col:38 --+--PLUS--
+token: line 44, column 38, sym: 60
+line:44 col:39 --argv--IDENTIFIER--
+token: line 44, column 39, sym: 98, value: 'argv'
+line:44 col:43 --[--LBRACK--
+token: line 44, column 43, sym: 10
+line:44 col:44 --i--IDENTIFIER--
+token: line 44, column 44, sym: 98, value: 'i'
+line:44 col:45 --]--RBRACK--
+token: line 44, column 45, sym: 11
+line:44 col:46 --+--PLUS--
+token: line 44, column 46, sym: 60
+line:44 col:49 --"--STRING_LITERAL--
+token: line 44, column 49, sym: 97, value: ']'
+line:44 col:50 --)--RPAREN--
+token: line 44, column 50, sym: 20
+line:44 col:51 --;--SEMICOLON--
+token: line 44, column 51, sym: 13
+line:45 col:9 --Scanner--IDENTIFIER--
+token: line 45, column 9, sym: 98, value: 'Scanner'
+line:45 col:17 --scanner--IDENTIFIER--
+token: line 45, column 17, sym: 98, value: 'scanner'
+line:45 col:25 --=--EQ--
+token: line 45, column 25, sym: 18
+line:45 col:27 --new--NEW--
+token: line 45, column 27, sym: 57
+line:45 col:31 --Scanner--IDENTIFIER--
+token: line 45, column 31, sym: 98, value: 'Scanner'
+line:45 col:38 --(--LPAREN--
+token: line 45, column 38, sym: 19
+line:45 col:39 --new--NEW--
+token: line 45, column 39, sym: 57
+line:45 col:43 --UnicodeEscapes--IDENTIFIER--
+token: line 45, column 43, sym: 98, value: 'UnicodeEscapes'
+line:45 col:57 --(--LPAREN--
+token: line 45, column 57, sym: 19
+line:45 col:58 --new--NEW--
+token: line 45, column 58, sym: 57
+line:45 col:62 --FileReader--IDENTIFIER--
+token: line 45, column 62, sym: 98, value: 'FileReader'
+line:45 col:72 --(--LPAREN--
+token: line 45, column 72, sym: 19
+line:45 col:73 --argv--IDENTIFIER--
+token: line 45, column 73, sym: 98, value: 'argv'
+line:45 col:77 --[--LBRACK--
+token: line 45, column 77, sym: 10
+line:45 col:78 --i--IDENTIFIER--
+token: line 45, column 78, sym: 98, value: 'i'
+line:45 col:79 --]--RBRACK--
+token: line 45, column 79, sym: 11
+line:45 col:80 --)--RPAREN--
+token: line 45, column 80, sym: 20
+line:45 col:81 --)--RPAREN--
+token: line 45, column 81, sym: 20
+line:45 col:82 --)--RPAREN--
+token: line 45, column 82, sym: 20
+line:45 col:83 --;--SEMICOLON--
+token: line 45, column 83, sym: 13
+line:47 col:9 --Symbol--IDENTIFIER--
+token: line 47, column 9, sym: 98, value: 'Symbol'
+line:47 col:16 --s--IDENTIFIER--
+token: line 47, column 16, sym: 98, value: 's'
+line:47 col:17 --;--SEMICOLON--
+token: line 47, column 17, sym: 13
+line:48 col:9 --do--DO--
+token: line 48, column 9, sym: 47
+line:48 col:12 --{--LBRACE--
+token: line 48, column 12, sym: 16
+line:49 col:11 --s--IDENTIFIER--
+token: line 49, column 11, sym: 98, value: 's'
+line:49 col:13 --=--EQ--
+token: line 49, column 13, sym: 18
+line:49 col:15 --scanner--IDENTIFIER--
+token: line 49, column 15, sym: 98, value: 'scanner'
+line:49 col:22 --.--DOT--
+token: line 49, column 22, sym: 12
+line:49 col:23 --debug_next_token--IDENTIFIER--
+token: line 49, column 23, sym: 98, value: 'debug_next_token'
+line:49 col:39 --(--LPAREN--
+token: line 49, column 39, sym: 19
+line:49 col:40 --)--RPAREN--
+token: line 49, column 40, sym: 20
+line:49 col:41 --;--SEMICOLON--
+token: line 49, column 41, sym: 13
+line:50 col:11 --System--IDENTIFIER--
+token: line 50, column 11, sym: 98, value: 'System'
+line:50 col:17 --.--DOT--
+token: line 50, column 17, sym: 12
+line:50 col:18 --out--IDENTIFIER--
+token: line 50, column 18, sym: 98, value: 'out'
+line:50 col:21 --.--DOT--
+token: line 50, column 21, sym: 12
+line:50 col:22 --println--IDENTIFIER--
+token: line 50, column 22, sym: 98, value: 'println'
+line:50 col:29 --(--LPAREN--
+token: line 50, column 29, sym: 19
+line:50 col:38 --"--STRING_LITERAL--
+token: line 50, column 38, sym: 97, value: 'token: '
+line:50 col:39 --+--PLUS--
+token: line 50, column 39, sym: 60
+line:50 col:40 --s--IDENTIFIER--
+token: line 50, column 40, sym: 98, value: 's'
+line:50 col:41 --)--RPAREN--
+token: line 50, column 41, sym: 20
+line:50 col:42 --;--SEMICOLON--
+token: line 50, column 42, sym: 13
+line:51 col:9 --}--RBRACE--
+token: line 51, column 9, sym: 17
+line:51 col:11 --while--WHILE--
+token: line 51, column 11, sym: 48
+line:51 col:17 --(--LPAREN--
+token: line 51, column 17, sym: 19
+line:51 col:18 --s--IDENTIFIER--
+token: line 51, column 18, sym: 98, value: 's'
+line:51 col:19 --.--DOT--
+token: line 51, column 19, sym: 12
+line:51 col:20 --sym--IDENTIFIER--
+token: line 51, column 20, sym: 98, value: 'sym'
+line:51 col:24 --!=--NOTEQ--
+token: line 51, column 24, sym: 75
+line:51 col:27 --sym--IDENTIFIER--
+token: line 51, column 27, sym: 98, value: 'sym'
+line:51 col:30 --.--DOT--
+token: line 51, column 30, sym: 12
+line:51 col:31 --EOF--IDENTIFIER--
+token: line 51, column 31, sym: 98, value: 'EOF'
+line:51 col:34 --)--RPAREN--
+token: line 51, column 34, sym: 20
+line:51 col:35 --;--SEMICOLON--
+token: line 51, column 35, sym: 13
+line:53 col:9 --System--IDENTIFIER--
+token: line 53, column 9, sym: 98, value: 'System'
+line:53 col:15 --.--DOT--
+token: line 53, column 15, sym: 12
+line:53 col:16 --out--IDENTIFIER--
+token: line 53, column 16, sym: 98, value: 'out'
+line:53 col:19 --.--DOT--
+token: line 53, column 19, sym: 12
+line:53 col:20 --println--IDENTIFIER--
+token: line 53, column 20, sym: 98, value: 'println'
+line:53 col:27 --(--LPAREN--
+token: line 53, column 27, sym: 19
+line:53 col:39 --"--STRING_LITERAL--
+token: line 53, column 39, sym: 97, value: 'No errors.'
+line:53 col:40 --)--RPAREN--
+token: line 53, column 40, sym: 20
+line:53 col:41 --;--SEMICOLON--
+token: line 53, column 41, sym: 13
+line:54 col:7 --}--RBRACE--
+token: line 54, column 7, sym: 17
+line:55 col:7 --catch--CATCH--
+token: line 55, column 7, sym: 55
+line:55 col:13 --(--LPAREN--
+token: line 55, column 13, sym: 19
+line:55 col:14 --Exception--IDENTIFIER--
+token: line 55, column 14, sym: 98, value: 'Exception'
+line:55 col:24 --e--IDENTIFIER--
+token: line 55, column 24, sym: 98, value: 'e'
+line:55 col:25 --)--RPAREN--
+token: line 55, column 25, sym: 20
+line:55 col:27 --{--LBRACE--
+token: line 55, column 27, sym: 16
+line:56 col:9 --e--IDENTIFIER--
+token: line 56, column 9, sym: 98, value: 'e'
+line:56 col:10 --.--DOT--
+token: line 56, column 10, sym: 12
+line:56 col:11 --printStackTrace--IDENTIFIER--
+token: line 56, column 11, sym: 98, value: 'printStackTrace'
+line:56 col:26 --(--LPAREN--
+token: line 56, column 26, sym: 19
+line:56 col:27 --System--IDENTIFIER--
+token: line 56, column 27, sym: 98, value: 'System'
+line:56 col:33 --.--DOT--
+token: line 56, column 33, sym: 12
+line:56 col:34 --out--IDENTIFIER--
+token: line 56, column 34, sym: 98, value: 'out'
+line:56 col:37 --)--RPAREN--
+token: line 56, column 37, sym: 20
+line:56 col:38 --;--SEMICOLON--
+token: line 56, column 38, sym: 13
+line:57 col:9 --System--IDENTIFIER--
+token: line 57, column 9, sym: 98, value: 'System'
+line:57 col:15 --.--DOT--
+token: line 57, column 15, sym: 12
+line:57 col:16 --exit--IDENTIFIER--
+token: line 57, column 16, sym: 98, value: 'exit'
+line:57 col:20 --(--LPAREN--
+token: line 57, column 20, sym: 19
+line:57 col:21 --1--INTEGER_LITERAL--
+token: line 57, column 21, sym: 93, value: '1'
+line:57 col:22 --)--RPAREN--
+token: line 57, column 22, sym: 20
+line:57 col:23 --;--SEMICOLON--
+token: line 57, column 23, sym: 13
+line:58 col:7 --}--RBRACE--
+token: line 58, column 7, sym: 17
+line:59 col:5 --}--RBRACE--
+token: line 59, column 5, sym: 17
+line:60 col:3 --}--RBRACE--
+token: line 60, column 3, sym: 17
+line:61 col:1 --}--RBRACE--
+token: line 61, column 1, sym: 17
+line:62 col:1 ----EOF--
+token: line 62, column 1, sym: 0
+No errors.
Index: /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/examples/java/unicode.flex
===================================================================
--- /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/examples/java/unicode.flex (revision 25585)
+++ /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/examples/java/unicode.flex (revision 25585)
@@ -0,0 +1,149 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright (C) 1998-2009 Gerwin Klein *
+ * All rights reserved. *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License. See the file *
+ * COPYRIGHT for more information. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License along *
+ * with this program; if not, write to the Free Software Foundation, Inc., *
+ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *
+ * *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+
+/* §3.3 of the Java Language Specification :
+
+UnicodeInputCharacter:
+
+ UnicodeEscape
+
+ RawInputCharacter
+
+ UnicodeEscape:
+
+ \ UnicodeMarker HexDigit HexDigit HexDigit HexDigit
+
+ UnicodeMarker:
+
+ u
+
+ UnicodeMarker u
+
+ RawInputCharacter:
+
+ any Unicode character
+
+ HexDigit: one of
+
+ 0 1 2 3 4 5 6 7 8 9 a b c d e f A B C D E F
+
+only an even number of '\' is eligible to start a Unicode escape sequence
+
+*/
+
+import java.io.*;
+
+%%
+
+%public
+%final
+%class UnicodeEscapes
+%extends FilterReader
+
+%int
+%function read
+
+%switch
+%16bit
+
+UnicodeEscape = {UnicodeMarker} {HexDigit} {4}
+UnicodeMarker = "u"+
+HexDigit = [0-9a-fA-F]
+
+%state DIGITS
+
+%init{
+ super(in);
+%init}
+
+%{
+ private boolean even;
+
+ private int value() {
+ int r = 0;
+
+ for (int k = zzMarkedPos-4; k < zzMarkedPos; k++) {
+ int c = zzBuffer[k];
+
+ if (c >= 'a')
+ c-= 'a'-10;
+ else if (c >= 'A')
+ c-= 'A'-10;
+ else
+ c-= '0';
+
+ r <<= 4;
+ r += c;
+ }
+
+ return r;
+ }
+
+ public int read(char cbuf[], int off, int len) throws IOException {
+ if ( !ready() ) return -1;
+
+ len+= off;
+
+ for (int i=off; i {
+ \\ { even = false; return '\\'; }
+ \\ / \\ { even = !even; return '\\'; }
+ \\ / "u" {
+ if (even) {
+ even = false;
+ return '\\';
+ }
+ else
+ yybegin(DIGITS);
+ }
+ .|\n { return zzBuffer[zzStartRead]; }
+
+ <> { return -1; }
+}
+
+ {
+ {UnicodeEscape} { yybegin(YYINITIAL); return value(); }
+ .|\n { throw new Error("incorrect Unicode escape"); }
+
+ <> { throw new Error("EOF in Unicode escape"); }
+}
Index: /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/examples/pom.xml
===================================================================
--- /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/examples/pom.xml (revision 25585)
+++ /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/examples/pom.xml (revision 25585)
@@ -0,0 +1,52 @@
+
+
+ 4.0.0
+ de.flex.examples
+ parent
+ 1
+ examples
+
+ Examples on how to use JFlex and maven-jflex-plugin
+
+ pom
+
+
+
+ de.jflex.maven.plugin
+ maven-jflex-plugin
+ 0.3
+
+
+
+ generate
+
+
+
+
+
+
+
+
+ jflex
+ JFlex repository
+ http://jflex.sourceforge.net/repo/
+
+
+
+
+
+ junit
+ junit
+ 3.8.2
+ test
+
+
+
+
+ simple-maven
+ standalone-maven
+
+
+
Index: /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/examples/simple-maven/README.txt
===================================================================
--- /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/examples/simple-maven/README.txt (revision 25585)
+++ /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/examples/simple-maven/README.txt (revision 25585)
@@ -0,0 +1,1 @@
+link src/site/apt/usage.apt
Index: /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/examples/simple-maven/pom.xml
===================================================================
--- /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/examples/simple-maven/pom.xml (revision 25585)
+++ /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/examples/simple-maven/pom.xml (revision 25585)
@@ -0,0 +1,26 @@
+
+
+ 4.0.0
+
+ de.flex.examples
+ parent
+ 1
+
+ simple-maven
+ 0.1
+ A scanner for a toy programming language.
+ It is the example from the JLex website with some small
+ modifications, to make it a bit more readable.
+
+ It does nothing really useful, because there is no parser for
+ the toy programming language. It's just a demonstration how a
+ small simple scanner looks like.
+
+
+ junit
+ junit
+ test
+
+
+
+
Index: /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/examples/simple-maven/src/README
===================================================================
--- /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/examples/simple-maven/src/README (revision 25585)
+++ /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/examples/simple-maven/src/README (revision 25585)
@@ -0,0 +1,10 @@
+This is a small Maven project that demeonstrates the use of maven-jflex-plugin.
+
+main/flex/simple.flex:
+ the example specification
+
+test/resources/test.txt:
+ sample input
+
+test/resources/output.good:
+ expected output matching the sample input from test.txt
Index: /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/examples/simple-maven/src/main/java/Utility.java
===================================================================
--- /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/examples/simple-maven/src/main/java/Utility.java (revision 25585)
+++ /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/examples/simple-maven/src/main/java/Utility.java (revision 25585)
@@ -0,0 +1,23 @@
+/**
+ * A small utility class.
+ * TODO: use reosurce bundle
+ */
+class Utility {
+
+ private static final String errorMsg[] = {
+ "Error: Unmatched end-of-comment punctuation.",
+ "Error: Unmatched start-of-comment punctuation.",
+ "Error: Unclosed string.",
+ "Error: Illegal character."
+ };
+
+ public static final int E_ENDCOMMENT = 0;
+ public static final int E_STARTCOMMENT = 1;
+ public static final int E_UNCLOSEDSTR = 2;
+ public static final int E_UNMATCHED = 3;
+
+ public static void error(int code) {
+ System.out.println(errorMsg[code]);
+ }
+}
+
Index: /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/examples/simple-maven/src/main/java/Yytoken.java
===================================================================
--- /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/examples/simple-maven/src/main/java/Yytoken.java (revision 25585)
+++ /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/examples/simple-maven/src/main/java/Yytoken.java (revision 25585)
@@ -0,0 +1,28 @@
+/**
+ * The tokens returned by the scanner.
+ *
+ */
+class Yytoken {
+ public int m_index;
+ public String m_text;
+ public int m_line;
+ public int m_charBegin;
+ public int m_charEnd;
+
+ Yytoken (int index, String text, int line, int charBegin, int charEnd) {
+ m_index = index;
+ m_text = text;
+ m_line = line;
+ m_charBegin = charBegin;
+ m_charEnd = charEnd;
+ }
+
+ public String toString() {
+ return "Text : "+m_text+
+ "\nindex : "+m_index+
+ "\nline : "+m_line+
+ "\ncBeg. : "+m_charBegin+
+ "\ncEnd. : "+m_charEnd;
+ }
+}
+
Index: /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/examples/simple-maven/src/main/jflex/simple.flex
===================================================================
--- /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/examples/simple-maven/src/main/jflex/simple.flex (revision 25585)
+++ /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/examples/simple-maven/src/main/jflex/simple.flex (revision 25585)
@@ -0,0 +1,86 @@
+/* this is the scanner example from the JLex website
+ (with small modifications to make it more readable) */
+
+%%
+
+%{
+ private int comment_count = 0;
+%}
+
+%line
+%char
+%state COMMENT
+%full
+
+%debug
+
+ALPHA=[A-Za-z]
+DIGIT=[0-9]
+NONNEWLINE_WHITE_SPACE_CHAR=[\ \t\b\012]
+NEWLINE=\r|\n|\r\n
+WHITE_SPACE_CHAR=[\n\r\ \t\b\012]
+STRING_TEXT=(\\\"|[^\n\r\"]|\\{WHITE_SPACE_CHAR}+\\)*
+COMMENT_TEXT=([^*/\n]|[^*\n]"/"[^*\n]|[^/\n]"*"[^/\n]|"*"[^/\n]|"/"[^*\n])*
+Ident = {ALPHA}({ALPHA}|{DIGIT}|_)*
+
+%%
+
+ {
+ "," { return (new Yytoken(0,yytext(),yyline,yychar,yychar+1)); }
+ ":" { return (new Yytoken(1,yytext(),yyline,yychar,yychar+1)); }
+ ";" { return (new Yytoken(2,yytext(),yyline,yychar,yychar+1)); }
+ "(" { return (new Yytoken(3,yytext(),yyline,yychar,yychar+1)); }
+ ")" { return (new Yytoken(4,yytext(),yyline,yychar,yychar+1)); }
+ "[" { return (new Yytoken(5,yytext(),yyline,yychar,yychar+1)); }
+ "]" { return (new Yytoken(6,yytext(),yyline,yychar,yychar+1)); }
+ "{" { return (new Yytoken(7,yytext(),yyline,yychar,yychar+1)); }
+ "}" { return (new Yytoken(8,yytext(),yyline,yychar,yychar+1)); }
+ "." { return (new Yytoken(9,yytext(),yyline,yychar,yychar+1)); }
+ "+" { return (new Yytoken(10,yytext(),yyline,yychar,yychar+1)); }
+ "-" { return (new Yytoken(11,yytext(),yyline,yychar,yychar+1)); }
+ "*" { return (new Yytoken(12,yytext(),yyline,yychar,yychar+1)); }
+ "/" { return (new Yytoken(13,yytext(),yyline,yychar,yychar+1)); }
+ "=" { return (new Yytoken(14,yytext(),yyline,yychar,yychar+1)); }
+ "<>" { return (new Yytoken(15,yytext(),yyline,yychar,yychar+2)); }
+ "<" { return (new Yytoken(16,yytext(),yyline,yychar,yychar+1)); }
+ "<=" { return (new Yytoken(17,yytext(),yyline,yychar,yychar+2)); }
+ ">" { return (new Yytoken(18,yytext(),yyline,yychar,yychar+1)); }
+ ">=" { return (new Yytoken(19,yytext(),yyline,yychar,yychar+2)); }
+ "&" { return (new Yytoken(20,yytext(),yyline,yychar,yychar+1)); }
+ "|" { return (new Yytoken(21,yytext(),yyline,yychar,yychar+1)); }
+ ":=" { return (new Yytoken(22,yytext(),yyline,yychar,yychar+2)); }
+
+ {NONNEWLINE_WHITE_SPACE_CHAR}+ { }
+
+ "/*" { yybegin(COMMENT); comment_count++; }
+
+ \"{STRING_TEXT}\" {
+ String str = yytext().substring(1,yylength()-1);
+ return (new Yytoken(40,str,yyline,yychar,yychar+yylength()));
+ }
+
+ \"{STRING_TEXT} {
+ String str = yytext().substring(1,yytext().length());
+ Utility.error(Utility.E_UNCLOSEDSTR);
+ return (new Yytoken(41,str,yyline,yychar,yychar + str.length()));
+ }
+
+ {DIGIT}+ { return (new Yytoken(42,yytext(),yyline,yychar,yychar+yylength())); }
+
+ {Ident} { return (new Yytoken(43,yytext(),yyline,yychar,yychar+yylength())); }
+}
+
+ {
+ "/*" { comment_count++; }
+ "*/" { if (--comment_count == 0) yybegin(YYINITIAL); }
+ {COMMENT_TEXT} { }
+}
+
+
+{NEWLINE} { }
+
+. {
+ System.out.println("Illegal character: <" + yytext() + ">");
+ Utility.error(Utility.E_UNMATCHED);
+}
+
Index: /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/examples/simple-maven/src/site/apt/usage.apt
===================================================================
--- /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/examples/simple-maven/src/site/apt/usage.apt (revision 25585)
+++ /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/examples/simple-maven/src/site/apt/usage.apt (revision 25585)
@@ -0,0 +1,100 @@
+ ------
+ Usage
+ ------
+ Gerwin Klein
+ Régis Décamps
+ ------
+ November 2, 2007
+ ------
+
+
+About this project
+
+ This sample project parses a grammar with JFlex.
+
+ The project management is done with Maven.
+
+ The project contains a simple grammar for the "Toy programming language".
+ It is the example from the JLex web site with some small
+ modifications, to make it a bit more readable.
+ It does nothing really useful, because there is no parser for
+ the toy programming language. It's just a demonstration how a
+ small simple scanner looks like.
+
+
+* JFlex
+
+ JFlex is a parser generator. Given a grammar, JFlex generate
+ Java (TM) code to parse documents that follow this grammar.
+
+* Maven
+
+ Maven is a project management framework.
+ The project is described in as a POM (project object model,
+ stored into <<>>).
+ This document isn't intended to be a tutorial on the use of Maven 2,
+ you should consult the {{{http://maven.apache.org/}Maven web site}}.
+
+ The integration of JFlex and Maven is done with
+ {{{http://jflex.sourceforge.net/maven-flex-plugin/}maven-flex-plugin}}.
+
+
+Usage
+
+* mvn generate-sources
+
+ The maven-jflex-plugin will read the grammar
+ <<>>
+ and generate a Java scanner <<>>
+ in <<>>
+
+ This is defined by the following section
+
++---------
+
+
+
+ de.jflex.maven.plugin
+ maven-jflex-plugin
+ 0.2
+
+
+
+ generate
+
+
+
+
+
+
++------------
+
+ By default, the maven-jflex-plugin generates a scanner/parser for every file
+ in <<>>.
+
+
+* mvn test
+
+ This goal test the generated scanner (if required, the lexer will be
+ generated and all Java classes will be compiled)
+ by running all tests in <<>>.
+
+ There is only one test in <<>>.
+ In this test,
+ the scanner is run with the input file <<>>.
+
+ By default, the scanner outputs debugging information about each
+ returned token to <<>> until the end of file is reached,
+ or an error occurs.
+ But in the test, the output is redirected into <<>>.
+
+ The test is successful if every line match
+ with <<>>,
+ which is the expected scanner debugging information.
+
+
+References
+
+ * {{{http://jflex.sourceforge.net/maven-flex-plugin/}maven-flex-plugin}}
+
+ * {{{http://maven.apache.org/}Maven web site}}.
Index: /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/examples/simple-maven/src/site/site.xml
===================================================================
--- /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/examples/simple-maven/src/site/site.xml (revision 25585)
+++ /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/examples/simple-maven/src/site/site.xml (revision 25585)
@@ -0,0 +1,9 @@
+
+
+
+
+
+
Index: /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/examples/simple-maven/src/test/java/YylexTest.java
===================================================================
--- /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/examples/simple-maven/src/test/java/YylexTest.java (revision 25585)
+++ /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/examples/simple-maven/src/test/java/YylexTest.java (revision 25585)
@@ -0,0 +1,59 @@
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.FileReader;
+import java.io.IOException;
+import java.io.PrintStream;
+
+import junit.framework.TestCase;
+
+/**
+ * This is an integration test.
+ *
+ * The class Yylex is generated by JFLex from
+ * src/main/jflex/simple.flex
.
+ *
+ * @author regis
+ *
+ */
+public class YylexTest extends TestCase {
+
+ private static final String OUTPUT_FILE = "target/output.actual";
+
+ /**
+ * Test that Yylex parser behaves like expected.
+ *
+ * @throws IOException
+ */
+ public void testOutput() throws IOException {
+ String[] argv = new String[1];
+ argv[0] = "src/test/resources/test.txt";
+
+ // the Yylex prints status on stdout
+ File actual = new File("target/output.actual");
+ actual.delete();
+ FileOutputStream fos = new FileOutputStream(OUTPUT_FILE, true);
+ System.setOut(new PrintStream(fos));
+
+ Yylex.main(argv);
+
+ fos.close();
+
+ // test actual is expected
+ File expected = new File("src/test/resources/output.good");
+ assertTrue(expected.isFile());
+ assertTrue(actual.isFile());
+
+ BufferedReader actualContent = new BufferedReader(
+ new FileReader(actual));
+ BufferedReader expectedContent = new BufferedReader(new FileReader(
+ expected));
+
+ for (int lineNumber = 1;lineNumber!=-1; lineNumber++) {
+ String expectedLine = expectedContent.readLine();
+ String actualLine = actualContent.readLine();
+ assertEquals("Line "+lineNumber, expectedLine, actualLine);
+ if (expectedLine==null) lineNumber=-2; //EOF
+ }
+ }
+}
Index: /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/examples/simple-maven/src/test/resources/output.good
===================================================================
--- /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/examples/simple-maven/src/test/resources/output.good (revision 25585)
+++ /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/examples/simple-maven/src/test/resources/output.good (revision 25585)
@@ -0,0 +1,660 @@
+line: 1 match: --class--
+action [70] { return (new Yytoken(43,yytext(),yyline,yychar,yychar+yylength())); }
+Text : class
+index : 43
+line : 0
+cBeg. : 0
+cEnd. : 5
+line: 1 match: -- --
+action [76] { }
+line: 1 match: --Utility--
+action [70] { return (new Yytoken(43,yytext(),yyline,yychar,yychar+yylength())); }
+Text : Utility
+index : 43
+line : 0
+cBeg. : 6
+cEnd. : 13
+line: 1 match: -- --
+action [76] { }
+line: 1 match: --{--
+action [36] { return (new Yytoken(7,yytext(),yyline,yychar,yychar+1)); }
+Text : {
+index : 7
+line : 0
+cBeg. : 14
+cEnd. : 15
+line: 1 match: --
+
+ --
+action [76] { }
+line: 3 match: --private--
+action [70] { return (new Yytoken(43,yytext(),yyline,yychar,yychar+yylength())); }
+Text : private
+index : 43
+line : 2
+cBeg. : 21
+cEnd. : 28
+line: 3 match: -- --
+action [76] { }
+line: 3 match: --static--
+action [70] { return (new Yytoken(43,yytext(),yyline,yychar,yychar+yylength())); }
+Text : static
+index : 43
+line : 2
+cBeg. : 29
+cEnd. : 35
+line: 3 match: -- --
+action [76] { }
+line: 3 match: --final--
+action [70] { return (new Yytoken(43,yytext(),yyline,yychar,yychar+yylength())); }
+Text : final
+index : 43
+line : 2
+cBeg. : 36
+cEnd. : 41
+line: 3 match: -- --
+action [76] { }
+line: 3 match: --String--
+action [70] { return (new Yytoken(43,yytext(),yyline,yychar,yychar+yylength())); }
+Text : String
+index : 43
+line : 2
+cBeg. : 42
+cEnd. : 48
+line: 3 match: -- --
+action [76] { }
+line: 3 match: --errorMsg--
+action [70] { return (new Yytoken(43,yytext(),yyline,yychar,yychar+yylength())); }
+Text : errorMsg
+index : 43
+line : 2
+cBeg. : 49
+cEnd. : 57
+line: 3 match: --[--
+action [34] { return (new Yytoken(5,yytext(),yyline,yychar,yychar+1)); }
+Text : [
+index : 5
+line : 2
+cBeg. : 57
+cEnd. : 58
+line: 3 match: --]--
+action [35] { return (new Yytoken(6,yytext(),yyline,yychar,yychar+1)); }
+Text : ]
+index : 6
+line : 2
+cBeg. : 58
+cEnd. : 59
+line: 3 match: -- --
+action [76] { }
+line: 3 match: --=--
+action [43] { return (new Yytoken(14,yytext(),yyline,yychar,yychar+1)); }
+Text : =
+index : 14
+line : 2
+cBeg. : 60
+cEnd. : 61
+line: 3 match: -- --
+action [76] { }
+line: 3 match: --{--
+action [36] { return (new Yytoken(7,yytext(),yyline,yychar,yychar+1)); }
+Text : {
+index : 7
+line : 2
+cBeg. : 62
+cEnd. : 63
+line: 3 match: --
+ --
+action [76] { }
+line: 4 match: --"Error: Unmatched end-of-comment punctuation."--
+action [57] { String str = yytext().substring(1,yylength()-1);
+ return (new Yytoken(40,str,yyline,yychar,yychar+yylength())); }
+Text : Error: Unmatched end-of-comment punctuation.
+index : 40
+line : 3
+cBeg. : 68
+cEnd. : 114
+line: 4 match: --,--
+action [29] { return (new Yytoken(0,yytext(),yyline,yychar,yychar+1)); }
+Text : ,
+index : 0
+line : 3
+cBeg. : 114
+cEnd. : 115
+line: 4 match: --
+ --
+action [76] { }
+line: 5 match: --"Error: Unmatched start-of-comment punctuation."--
+action [57] { String str = yytext().substring(1,yylength()-1);
+ return (new Yytoken(40,str,yyline,yychar,yychar+yylength())); }
+Text : Error: Unmatched start-of-comment punctuation.
+index : 40
+line : 4
+cBeg. : 120
+cEnd. : 168
+line: 5 match: --,--
+action [29] { return (new Yytoken(0,yytext(),yyline,yychar,yychar+1)); }
+Text : ,
+index : 0
+line : 4
+cBeg. : 168
+cEnd. : 169
+line: 5 match: --
+ --
+action [76] { }
+line: 6 match: --"Error: Unclosed string."--
+action [57] { String str = yytext().substring(1,yylength()-1);
+ return (new Yytoken(40,str,yyline,yychar,yychar+yylength())); }
+Text : Error: Unclosed string.
+index : 40
+line : 5
+cBeg. : 174
+cEnd. : 199
+line: 6 match: --,--
+action [29] { return (new Yytoken(0,yytext(),yyline,yychar,yychar+1)); }
+Text : ,
+index : 0
+line : 5
+cBeg. : 199
+cEnd. : 200
+line: 6 match: --
+ --
+action [76] { }
+line: 7 match: --"Error: Illegal character."--
+action [57] { String str = yytext().substring(1,yylength()-1);
+ return (new Yytoken(40,str,yyline,yychar,yychar+yylength())); }
+Text : Error: Illegal character.
+index : 40
+line : 6
+cBeg. : 205
+cEnd. : 232
+line: 7 match: --
+ --
+action [76] { }
+line: 8 match: --}--
+action [37] { return (new Yytoken(8,yytext(),yyline,yychar,yychar+1)); }
+Text : }
+index : 8
+line : 7
+cBeg. : 237
+cEnd. : 238
+line: 8 match: --;--
+action [31] { return (new Yytoken(2,yytext(),yyline,yychar,yychar+1)); }
+Text : ;
+index : 2
+line : 7
+cBeg. : 238
+cEnd. : 239
+line: 8 match: --
+
+ --
+action [76] { }
+line: 10 match: --public--
+action [70] { return (new Yytoken(43,yytext(),yyline,yychar,yychar+yylength())); }
+Text : public
+index : 43
+line : 9
+cBeg. : 245
+cEnd. : 251
+line: 10 match: -- --
+action [76] { }
+line: 10 match: --static--
+action [70] { return (new Yytoken(43,yytext(),yyline,yychar,yychar+yylength())); }
+Text : static
+index : 43
+line : 9
+cBeg. : 252
+cEnd. : 258
+line: 10 match: -- --
+action [76] { }
+line: 10 match: --final--
+action [70] { return (new Yytoken(43,yytext(),yyline,yychar,yychar+yylength())); }
+Text : final
+index : 43
+line : 9
+cBeg. : 259
+cEnd. : 264
+line: 10 match: -- --
+action [76] { }
+line: 10 match: --int--
+action [70] { return (new Yytoken(43,yytext(),yyline,yychar,yychar+yylength())); }
+Text : int
+index : 43
+line : 9
+cBeg. : 265
+cEnd. : 268
+line: 10 match: -- --
+action [76] { }
+line: 10 match: --E_ENDCOMMENT--
+action [70] { return (new Yytoken(43,yytext(),yyline,yychar,yychar+yylength())); }
+Text : E_ENDCOMMENT
+index : 43
+line : 9
+cBeg. : 269
+cEnd. : 281
+line: 10 match: -- --
+action [76] { }
+line: 10 match: --=--
+action [43] { return (new Yytoken(14,yytext(),yyline,yychar,yychar+1)); }
+Text : =
+index : 14
+line : 9
+cBeg. : 282
+cEnd. : 283
+line: 10 match: -- --
+action [76] { }
+line: 10 match: --0--
+action [68] { return (new Yytoken(42,yytext(),yyline,yychar,yychar+yylength())); }
+Text : 0
+index : 42
+line : 9
+cBeg. : 284
+cEnd. : 285
+line: 10 match: --;--
+action [31] { return (new Yytoken(2,yytext(),yyline,yychar,yychar+1)); }
+Text : ;
+index : 2
+line : 9
+cBeg. : 285
+cEnd. : 286
+line: 10 match: --
+ --
+action [76] { }
+line: 11 match: --public--
+action [70] { return (new Yytoken(43,yytext(),yyline,yychar,yychar+yylength())); }
+Text : public
+index : 43
+line : 10
+cBeg. : 290
+cEnd. : 296
+line: 11 match: -- --
+action [76] { }
+line: 11 match: --static--
+action [70] { return (new Yytoken(43,yytext(),yyline,yychar,yychar+yylength())); }
+Text : static
+index : 43
+line : 10
+cBeg. : 297
+cEnd. : 303
+line: 11 match: -- --
+action [76] { }
+line: 11 match: --final--
+action [70] { return (new Yytoken(43,yytext(),yyline,yychar,yychar+yylength())); }
+Text : final
+index : 43
+line : 10
+cBeg. : 304
+cEnd. : 309
+line: 11 match: -- --
+action [76] { }
+line: 11 match: --int--
+action [70] { return (new Yytoken(43,yytext(),yyline,yychar,yychar+yylength())); }
+Text : int
+index : 43
+line : 10
+cBeg. : 310
+cEnd. : 313
+line: 11 match: -- --
+action [76] { }
+line: 11 match: --E_STARTCOMMENT--
+action [70] { return (new Yytoken(43,yytext(),yyline,yychar,yychar+yylength())); }
+Text : E_STARTCOMMENT
+index : 43
+line : 10
+cBeg. : 314
+cEnd. : 328
+line: 11 match: -- --
+action [76] { }
+line: 11 match: --=--
+action [43] { return (new Yytoken(14,yytext(),yyline,yychar,yychar+1)); }
+Text : =
+index : 14
+line : 10
+cBeg. : 329
+cEnd. : 330
+line: 11 match: -- --
+action [76] { }
+line: 11 match: --1--
+action [68] { return (new Yytoken(42,yytext(),yyline,yychar,yychar+yylength())); }
+Text : 1
+index : 42
+line : 10
+cBeg. : 331
+cEnd. : 332
+line: 11 match: --;--
+action [31] { return (new Yytoken(2,yytext(),yyline,yychar,yychar+1)); }
+Text : ;
+index : 2
+line : 10
+cBeg. : 332
+cEnd. : 333
+line: 11 match: --
+ --
+action [76] { }
+line: 12 match: --public--
+action [70] { return (new Yytoken(43,yytext(),yyline,yychar,yychar+yylength())); }
+Text : public
+index : 43
+line : 11
+cBeg. : 337
+cEnd. : 343
+line: 12 match: -- --
+action [76] { }
+line: 12 match: --static--
+action [70] { return (new Yytoken(43,yytext(),yyline,yychar,yychar+yylength())); }
+Text : static
+index : 43
+line : 11
+cBeg. : 344
+cEnd. : 350
+line: 12 match: -- --
+action [76] { }
+line: 12 match: --final--
+action [70] { return (new Yytoken(43,yytext(),yyline,yychar,yychar+yylength())); }
+Text : final
+index : 43
+line : 11
+cBeg. : 351
+cEnd. : 356
+line: 12 match: -- --
+action [76] { }
+line: 12 match: --int--
+action [70] { return (new Yytoken(43,yytext(),yyline,yychar,yychar+yylength())); }
+Text : int
+index : 43
+line : 11
+cBeg. : 357
+cEnd. : 360
+line: 12 match: -- --
+action [76] { }
+line: 12 match: --E_UNCLOSEDSTR--
+action [70] { return (new Yytoken(43,yytext(),yyline,yychar,yychar+yylength())); }
+Text : E_UNCLOSEDSTR
+index : 43
+line : 11
+cBeg. : 361
+cEnd. : 374
+line: 12 match: -- --
+action [76] { }
+line: 12 match: --=--
+action [43] { return (new Yytoken(14,yytext(),yyline,yychar,yychar+1)); }
+Text : =
+index : 14
+line : 11
+cBeg. : 375
+cEnd. : 376
+line: 12 match: -- --
+action [76] { }
+line: 12 match: --2--
+action [68] { return (new Yytoken(42,yytext(),yyline,yychar,yychar+yylength())); }
+Text : 2
+index : 42
+line : 11
+cBeg. : 377
+cEnd. : 378
+line: 12 match: --;--
+action [31] { return (new Yytoken(2,yytext(),yyline,yychar,yychar+1)); }
+Text : ;
+index : 2
+line : 11
+cBeg. : 378
+cEnd. : 379
+line: 12 match: --
+ --
+action [76] { }
+line: 13 match: --public--
+action [70] { return (new Yytoken(43,yytext(),yyline,yychar,yychar+yylength())); }
+Text : public
+index : 43
+line : 12
+cBeg. : 383
+cEnd. : 389
+line: 13 match: -- --
+action [76] { }
+line: 13 match: --static--
+action [70] { return (new Yytoken(43,yytext(),yyline,yychar,yychar+yylength())); }
+Text : static
+index : 43
+line : 12
+cBeg. : 390
+cEnd. : 396
+line: 13 match: -- --
+action [76] { }
+line: 13 match: --final--
+action [70] { return (new Yytoken(43,yytext(),yyline,yychar,yychar+yylength())); }
+Text : final
+index : 43
+line : 12
+cBeg. : 397
+cEnd. : 402
+line: 13 match: -- --
+action [76] { }
+line: 13 match: --int--
+action [70] { return (new Yytoken(43,yytext(),yyline,yychar,yychar+yylength())); }
+Text : int
+index : 43
+line : 12
+cBeg. : 403
+cEnd. : 406
+line: 13 match: -- --
+action [76] { }
+line: 13 match: --E_UNMATCHED--
+action [70] { return (new Yytoken(43,yytext(),yyline,yychar,yychar+yylength())); }
+Text : E_UNMATCHED
+index : 43
+line : 12
+cBeg. : 407
+cEnd. : 418
+line: 13 match: -- --
+action [76] { }
+line: 13 match: --=--
+action [43] { return (new Yytoken(14,yytext(),yyline,yychar,yychar+1)); }
+Text : =
+index : 14
+line : 12
+cBeg. : 419
+cEnd. : 420
+line: 13 match: -- --
+action [76] { }
+line: 13 match: --3--
+action [68] { return (new Yytoken(42,yytext(),yyline,yychar,yychar+yylength())); }
+Text : 3
+index : 42
+line : 12
+cBeg. : 421
+cEnd. : 422
+line: 13 match: --;--
+action [31] { return (new Yytoken(2,yytext(),yyline,yychar,yychar+1)); }
+Text : ;
+index : 2
+line : 12
+cBeg. : 422
+cEnd. : 423
+line: 13 match: --
+
+ --
+action [76] { }
+line: 15 match: --public--
+action [70] { return (new Yytoken(43,yytext(),yyline,yychar,yychar+yylength())); }
+Text : public
+index : 43
+line : 14
+cBeg. : 428
+cEnd. : 434
+line: 15 match: -- --
+action [76] { }
+line: 15 match: --static--
+action [70] { return (new Yytoken(43,yytext(),yyline,yychar,yychar+yylength())); }
+Text : static
+index : 43
+line : 14
+cBeg. : 435
+cEnd. : 441
+line: 15 match: -- --
+action [76] { }
+line: 15 match: --void--
+action [70] { return (new Yytoken(43,yytext(),yyline,yychar,yychar+yylength())); }
+Text : void
+index : 43
+line : 14
+cBeg. : 442
+cEnd. : 446
+line: 15 match: -- --
+action [76] { }
+line: 15 match: --error--
+action [70] { return (new Yytoken(43,yytext(),yyline,yychar,yychar+yylength())); }
+Text : error
+index : 43
+line : 14
+cBeg. : 447
+cEnd. : 452
+line: 15 match: --(--
+action [32] { return (new Yytoken(3,yytext(),yyline,yychar,yychar+1)); }
+Text : (
+index : 3
+line : 14
+cBeg. : 452
+cEnd. : 453
+line: 15 match: --int--
+action [70] { return (new Yytoken(43,yytext(),yyline,yychar,yychar+yylength())); }
+Text : int
+index : 43
+line : 14
+cBeg. : 453
+cEnd. : 456
+line: 15 match: -- --
+action [76] { }
+line: 15 match: --code--
+action [70] { return (new Yytoken(43,yytext(),yyline,yychar,yychar+yylength())); }
+Text : code
+index : 43
+line : 14
+cBeg. : 457
+cEnd. : 461
+line: 15 match: --)--
+action [33] { return (new Yytoken(4,yytext(),yyline,yychar,yychar+1)); }
+Text : )
+index : 4
+line : 14
+cBeg. : 461
+cEnd. : 462
+line: 15 match: -- --
+action [76] { }
+line: 15 match: --{--
+action [36] { return (new Yytoken(7,yytext(),yyline,yychar,yychar+1)); }
+Text : {
+index : 7
+line : 14
+cBeg. : 463
+cEnd. : 464
+line: 15 match: --
+ --
+action [76] { }
+line: 16 match: --System--
+action [70] { return (new Yytoken(43,yytext(),yyline,yychar,yychar+yylength())); }
+Text : System
+index : 43
+line : 15
+cBeg. : 468
+cEnd. : 474
+line: 16 match: --.--
+action [38] { return (new Yytoken(9,yytext(),yyline,yychar,yychar+1)); }
+Text : .
+index : 9
+line : 15
+cBeg. : 474
+cEnd. : 475
+line: 16 match: --out--
+action [70] { return (new Yytoken(43,yytext(),yyline,yychar,yychar+yylength())); }
+Text : out
+index : 43
+line : 15
+cBeg. : 475
+cEnd. : 478
+line: 16 match: --.--
+action [38] { return (new Yytoken(9,yytext(),yyline,yychar,yychar+1)); }
+Text : .
+index : 9
+line : 15
+cBeg. : 478
+cEnd. : 479
+line: 16 match: --println--
+action [70] { return (new Yytoken(43,yytext(),yyline,yychar,yychar+yylength())); }
+Text : println
+index : 43
+line : 15
+cBeg. : 479
+cEnd. : 486
+line: 16 match: --(--
+action [32] { return (new Yytoken(3,yytext(),yyline,yychar,yychar+1)); }
+Text : (
+index : 3
+line : 15
+cBeg. : 486
+cEnd. : 487
+line: 16 match: --errorMsg--
+action [70] { return (new Yytoken(43,yytext(),yyline,yychar,yychar+yylength())); }
+Text : errorMsg
+index : 43
+line : 15
+cBeg. : 487
+cEnd. : 495
+line: 16 match: --[--
+action [34] { return (new Yytoken(5,yytext(),yyline,yychar,yychar+1)); }
+Text : [
+index : 5
+line : 15
+cBeg. : 495
+cEnd. : 496
+line: 16 match: --code--
+action [70] { return (new Yytoken(43,yytext(),yyline,yychar,yychar+yylength())); }
+Text : code
+index : 43
+line : 15
+cBeg. : 496
+cEnd. : 500
+line: 16 match: --]--
+action [35] { return (new Yytoken(6,yytext(),yyline,yychar,yychar+1)); }
+Text : ]
+index : 6
+line : 15
+cBeg. : 500
+cEnd. : 501
+line: 16 match: --)--
+action [33] { return (new Yytoken(4,yytext(),yyline,yychar,yychar+1)); }
+Text : )
+index : 4
+line : 15
+cBeg. : 501
+cEnd. : 502
+line: 16 match: --;--
+action [31] { return (new Yytoken(2,yytext(),yyline,yychar,yychar+1)); }
+Text : ;
+index : 2
+line : 15
+cBeg. : 502
+cEnd. : 503
+line: 16 match: --
+ --
+action [76] { }
+line: 17 match: --}--
+action [37] { return (new Yytoken(8,yytext(),yyline,yychar,yychar+1)); }
+Text : }
+index : 8
+line : 16
+cBeg. : 506
+cEnd. : 507
+line: 17 match: --
+--
+action [76] { }
+line: 18 match: --}--
+action [37] { return (new Yytoken(8,yytext(),yyline,yychar,yychar+1)); }
+Text : }
+index : 8
+line : 17
+cBeg. : 508
+cEnd. : 509
+line: 18 match: --
+
+--
+action [76] { }
+null
Index: /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/examples/simple-maven/src/test/resources/test.txt
===================================================================
--- /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/examples/simple-maven/src/test/resources/test.txt (revision 25585)
+++ /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/examples/simple-maven/src/test/resources/test.txt (revision 25585)
@@ -0,0 +1,19 @@
+class Utility {
+
+ private static final String errorMsg[] = {
+ "Error: Unmatched end-of-comment punctuation.",
+ "Error: Unmatched start-of-comment punctuation.",
+ "Error: Unclosed string.",
+ "Error: Illegal character."
+ };
+
+ public static final int E_ENDCOMMENT = 0;
+ public static final int E_STARTCOMMENT = 1;
+ public static final int E_UNCLOSEDSTR = 2;
+ public static final int E_UNMATCHED = 3;
+
+ public static void error(int code) {
+ System.out.println(errorMsg[code]);
+ }
+}
+
Index: /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/examples/simple/Makefile
===================================================================
--- /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/examples/simple/Makefile (revision 25585)
+++ /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/examples/simple/Makefile (revision 25585)
@@ -0,0 +1,23 @@
+JAVA=java
+JAVAC=javac
+JFLEX=jflex
+CUP=$(JAVA) java_cup.Main <
+
+all: test
+
+test: output.txt
+ @(diff output.txt output.good && echo "Test OK!") || echo "Test failed!"
+
+output.txt: Yylex.class test.txt
+ $(JAVA) Yylex test.txt > output.txt
+
+Yylex.class: Yylex.java Yytoken.java Utility.java
+
+%.class: %.java
+ $(JAVAC) $^
+
+Yylex.java: simple.flex
+ $(JFLEX) simple.flex
+
+clean:
+ rm -f Yylex.java output.txt *.class *~
Index: /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/examples/simple/README
===================================================================
--- /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/examples/simple/README (revision 25585)
+++ /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/examples/simple/README (revision 25585)
@@ -0,0 +1,29 @@
+This directory contains a scanner for a toy programming language.
+
+It is the example from the JLex website with some small modifications,
+to make it a bit more readable.
+
+It does nothing really useful, because there is no parser for the
+toy programming language. It's just a demonstatration how a small simple
+scanner looks like.
+
+files:
+
+YYtoken.java:
+ the tokens returned by the scanner
+
+Utility.java:
+ small class collecting some utility functions
+
+simple.flex:
+ the example specification
+
+test.txt:
+ sample input
+
+output.good:
+ output matching the sample input from test.txt
+
+Makefile: (for Unix only)
+ make to generate scanner and run test
+ make clean to remove generated files
Index: /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/examples/simple/Utility.java
===================================================================
--- /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/examples/simple/Utility.java (revision 25585)
+++ /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/examples/simple/Utility.java (revision 25585)
@@ -0,0 +1,19 @@
+class Utility {
+
+ private static final String errorMsg[] = {
+ "Error: Unmatched end-of-comment punctuation.",
+ "Error: Unmatched start-of-comment punctuation.",
+ "Error: Unclosed string.",
+ "Error: Illegal character."
+ };
+
+ public static final int E_ENDCOMMENT = 0;
+ public static final int E_STARTCOMMENT = 1;
+ public static final int E_UNCLOSEDSTR = 2;
+ public static final int E_UNMATCHED = 3;
+
+ public static void error(int code) {
+ System.out.println(errorMsg[code]);
+ }
+}
+
Index: /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/examples/simple/Yytoken.java
===================================================================
--- /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/examples/simple/Yytoken.java (revision 25585)
+++ /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/examples/simple/Yytoken.java (revision 25585)
@@ -0,0 +1,24 @@
+class Yytoken {
+ public int m_index;
+ public String m_text;
+ public int m_line;
+ public int m_charBegin;
+ public int m_charEnd;
+
+ Yytoken (int index, String text, int line, int charBegin, int charEnd) {
+ m_index = index;
+ m_text = text;
+ m_line = line;
+ m_charBegin = charBegin;
+ m_charEnd = charEnd;
+ }
+
+ public String toString() {
+ return "Text : "+m_text+
+ "\nindex : "+m_index+
+ "\nline : "+m_line+
+ "\ncBeg. : "+m_charBegin+
+ "\ncEnd. : "+m_charEnd;
+ }
+}
+
Index: /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/examples/simple/output.good
===================================================================
--- /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/examples/simple/output.good (revision 25585)
+++ /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/examples/simple/output.good (revision 25585)
@@ -0,0 +1,660 @@
+line: 1 match: --class--
+action [70] { return (new Yytoken(43,yytext(),yyline,yychar,yychar+yylength())); }
+Text : class
+index : 43
+line : 0
+cBeg. : 0
+cEnd. : 5
+line: 1 match: -- --
+action [76] { }
+line: 1 match: --Utility--
+action [70] { return (new Yytoken(43,yytext(),yyline,yychar,yychar+yylength())); }
+Text : Utility
+index : 43
+line : 0
+cBeg. : 6
+cEnd. : 13
+line: 1 match: -- --
+action [76] { }
+line: 1 match: --{--
+action [36] { return (new Yytoken(7,yytext(),yyline,yychar,yychar+1)); }
+Text : {
+index : 7
+line : 0
+cBeg. : 14
+cEnd. : 15
+line: 1 match: --
+
+ --
+action [76] { }
+line: 3 match: --private--
+action [70] { return (new Yytoken(43,yytext(),yyline,yychar,yychar+yylength())); }
+Text : private
+index : 43
+line : 2
+cBeg. : 21
+cEnd. : 28
+line: 3 match: -- --
+action [76] { }
+line: 3 match: --static--
+action [70] { return (new Yytoken(43,yytext(),yyline,yychar,yychar+yylength())); }
+Text : static
+index : 43
+line : 2
+cBeg. : 29
+cEnd. : 35
+line: 3 match: -- --
+action [76] { }
+line: 3 match: --final--
+action [70] { return (new Yytoken(43,yytext(),yyline,yychar,yychar+yylength())); }
+Text : final
+index : 43
+line : 2
+cBeg. : 36
+cEnd. : 41
+line: 3 match: -- --
+action [76] { }
+line: 3 match: --String--
+action [70] { return (new Yytoken(43,yytext(),yyline,yychar,yychar+yylength())); }
+Text : String
+index : 43
+line : 2
+cBeg. : 42
+cEnd. : 48
+line: 3 match: -- --
+action [76] { }
+line: 3 match: --errorMsg--
+action [70] { return (new Yytoken(43,yytext(),yyline,yychar,yychar+yylength())); }
+Text : errorMsg
+index : 43
+line : 2
+cBeg. : 49
+cEnd. : 57
+line: 3 match: --[--
+action [34] { return (new Yytoken(5,yytext(),yyline,yychar,yychar+1)); }
+Text : [
+index : 5
+line : 2
+cBeg. : 57
+cEnd. : 58
+line: 3 match: --]--
+action [35] { return (new Yytoken(6,yytext(),yyline,yychar,yychar+1)); }
+Text : ]
+index : 6
+line : 2
+cBeg. : 58
+cEnd. : 59
+line: 3 match: -- --
+action [76] { }
+line: 3 match: --=--
+action [43] { return (new Yytoken(14,yytext(),yyline,yychar,yychar+1)); }
+Text : =
+index : 14
+line : 2
+cBeg. : 60
+cEnd. : 61
+line: 3 match: -- --
+action [76] { }
+line: 3 match: --{--
+action [36] { return (new Yytoken(7,yytext(),yyline,yychar,yychar+1)); }
+Text : {
+index : 7
+line : 2
+cBeg. : 62
+cEnd. : 63
+line: 3 match: --
+ --
+action [76] { }
+line: 4 match: --"Error: Unmatched end-of-comment punctuation."--
+action [57] { String str = yytext().substring(1,yylength()-1);
+ return (new Yytoken(40,str,yyline,yychar,yychar+yylength())); }
+Text : Error: Unmatched end-of-comment punctuation.
+index : 40
+line : 3
+cBeg. : 68
+cEnd. : 114
+line: 4 match: --,--
+action [29] { return (new Yytoken(0,yytext(),yyline,yychar,yychar+1)); }
+Text : ,
+index : 0
+line : 3
+cBeg. : 114
+cEnd. : 115
+line: 4 match: --
+ --
+action [76] { }
+line: 5 match: --"Error: Unmatched start-of-comment punctuation."--
+action [57] { String str = yytext().substring(1,yylength()-1);
+ return (new Yytoken(40,str,yyline,yychar,yychar+yylength())); }
+Text : Error: Unmatched start-of-comment punctuation.
+index : 40
+line : 4
+cBeg. : 120
+cEnd. : 168
+line: 5 match: --,--
+action [29] { return (new Yytoken(0,yytext(),yyline,yychar,yychar+1)); }
+Text : ,
+index : 0
+line : 4
+cBeg. : 168
+cEnd. : 169
+line: 5 match: --
+ --
+action [76] { }
+line: 6 match: --"Error: Unclosed string."--
+action [57] { String str = yytext().substring(1,yylength()-1);
+ return (new Yytoken(40,str,yyline,yychar,yychar+yylength())); }
+Text : Error: Unclosed string.
+index : 40
+line : 5
+cBeg. : 174
+cEnd. : 199
+line: 6 match: --,--
+action [29] { return (new Yytoken(0,yytext(),yyline,yychar,yychar+1)); }
+Text : ,
+index : 0
+line : 5
+cBeg. : 199
+cEnd. : 200
+line: 6 match: --
+ --
+action [76] { }
+line: 7 match: --"Error: Illegal character."--
+action [57] { String str = yytext().substring(1,yylength()-1);
+ return (new Yytoken(40,str,yyline,yychar,yychar+yylength())); }
+Text : Error: Illegal character.
+index : 40
+line : 6
+cBeg. : 205
+cEnd. : 232
+line: 7 match: --
+ --
+action [76] { }
+line: 8 match: --}--
+action [37] { return (new Yytoken(8,yytext(),yyline,yychar,yychar+1)); }
+Text : }
+index : 8
+line : 7
+cBeg. : 237
+cEnd. : 238
+line: 8 match: --;--
+action [31] { return (new Yytoken(2,yytext(),yyline,yychar,yychar+1)); }
+Text : ;
+index : 2
+line : 7
+cBeg. : 238
+cEnd. : 239
+line: 8 match: --
+
+ --
+action [76] { }
+line: 10 match: --public--
+action [70] { return (new Yytoken(43,yytext(),yyline,yychar,yychar+yylength())); }
+Text : public
+index : 43
+line : 9
+cBeg. : 245
+cEnd. : 251
+line: 10 match: -- --
+action [76] { }
+line: 10 match: --static--
+action [70] { return (new Yytoken(43,yytext(),yyline,yychar,yychar+yylength())); }
+Text : static
+index : 43
+line : 9
+cBeg. : 252
+cEnd. : 258
+line: 10 match: -- --
+action [76] { }
+line: 10 match: --final--
+action [70] { return (new Yytoken(43,yytext(),yyline,yychar,yychar+yylength())); }
+Text : final
+index : 43
+line : 9
+cBeg. : 259
+cEnd. : 264
+line: 10 match: -- --
+action [76] { }
+line: 10 match: --int--
+action [70] { return (new Yytoken(43,yytext(),yyline,yychar,yychar+yylength())); }
+Text : int
+index : 43
+line : 9
+cBeg. : 265
+cEnd. : 268
+line: 10 match: -- --
+action [76] { }
+line: 10 match: --E_ENDCOMMENT--
+action [70] { return (new Yytoken(43,yytext(),yyline,yychar,yychar+yylength())); }
+Text : E_ENDCOMMENT
+index : 43
+line : 9
+cBeg. : 269
+cEnd. : 281
+line: 10 match: -- --
+action [76] { }
+line: 10 match: --=--
+action [43] { return (new Yytoken(14,yytext(),yyline,yychar,yychar+1)); }
+Text : =
+index : 14
+line : 9
+cBeg. : 282
+cEnd. : 283
+line: 10 match: -- --
+action [76] { }
+line: 10 match: --0--
+action [68] { return (new Yytoken(42,yytext(),yyline,yychar,yychar+yylength())); }
+Text : 0
+index : 42
+line : 9
+cBeg. : 284
+cEnd. : 285
+line: 10 match: --;--
+action [31] { return (new Yytoken(2,yytext(),yyline,yychar,yychar+1)); }
+Text : ;
+index : 2
+line : 9
+cBeg. : 285
+cEnd. : 286
+line: 10 match: --
+ --
+action [76] { }
+line: 11 match: --public--
+action [70] { return (new Yytoken(43,yytext(),yyline,yychar,yychar+yylength())); }
+Text : public
+index : 43
+line : 10
+cBeg. : 290
+cEnd. : 296
+line: 11 match: -- --
+action [76] { }
+line: 11 match: --static--
+action [70] { return (new Yytoken(43,yytext(),yyline,yychar,yychar+yylength())); }
+Text : static
+index : 43
+line : 10
+cBeg. : 297
+cEnd. : 303
+line: 11 match: -- --
+action [76] { }
+line: 11 match: --final--
+action [70] { return (new Yytoken(43,yytext(),yyline,yychar,yychar+yylength())); }
+Text : final
+index : 43
+line : 10
+cBeg. : 304
+cEnd. : 309
+line: 11 match: -- --
+action [76] { }
+line: 11 match: --int--
+action [70] { return (new Yytoken(43,yytext(),yyline,yychar,yychar+yylength())); }
+Text : int
+index : 43
+line : 10
+cBeg. : 310
+cEnd. : 313
+line: 11 match: -- --
+action [76] { }
+line: 11 match: --E_STARTCOMMENT--
+action [70] { return (new Yytoken(43,yytext(),yyline,yychar,yychar+yylength())); }
+Text : E_STARTCOMMENT
+index : 43
+line : 10
+cBeg. : 314
+cEnd. : 328
+line: 11 match: -- --
+action [76] { }
+line: 11 match: --=--
+action [43] { return (new Yytoken(14,yytext(),yyline,yychar,yychar+1)); }
+Text : =
+index : 14
+line : 10
+cBeg. : 329
+cEnd. : 330
+line: 11 match: -- --
+action [76] { }
+line: 11 match: --1--
+action [68] { return (new Yytoken(42,yytext(),yyline,yychar,yychar+yylength())); }
+Text : 1
+index : 42
+line : 10
+cBeg. : 331
+cEnd. : 332
+line: 11 match: --;--
+action [31] { return (new Yytoken(2,yytext(),yyline,yychar,yychar+1)); }
+Text : ;
+index : 2
+line : 10
+cBeg. : 332
+cEnd. : 333
+line: 11 match: --
+ --
+action [76] { }
+line: 12 match: --public--
+action [70] { return (new Yytoken(43,yytext(),yyline,yychar,yychar+yylength())); }
+Text : public
+index : 43
+line : 11
+cBeg. : 337
+cEnd. : 343
+line: 12 match: -- --
+action [76] { }
+line: 12 match: --static--
+action [70] { return (new Yytoken(43,yytext(),yyline,yychar,yychar+yylength())); }
+Text : static
+index : 43
+line : 11
+cBeg. : 344
+cEnd. : 350
+line: 12 match: -- --
+action [76] { }
+line: 12 match: --final--
+action [70] { return (new Yytoken(43,yytext(),yyline,yychar,yychar+yylength())); }
+Text : final
+index : 43
+line : 11
+cBeg. : 351
+cEnd. : 356
+line: 12 match: -- --
+action [76] { }
+line: 12 match: --int--
+action [70] { return (new Yytoken(43,yytext(),yyline,yychar,yychar+yylength())); }
+Text : int
+index : 43
+line : 11
+cBeg. : 357
+cEnd. : 360
+line: 12 match: -- --
+action [76] { }
+line: 12 match: --E_UNCLOSEDSTR--
+action [70] { return (new Yytoken(43,yytext(),yyline,yychar,yychar+yylength())); }
+Text : E_UNCLOSEDSTR
+index : 43
+line : 11
+cBeg. : 361
+cEnd. : 374
+line: 12 match: -- --
+action [76] { }
+line: 12 match: --=--
+action [43] { return (new Yytoken(14,yytext(),yyline,yychar,yychar+1)); }
+Text : =
+index : 14
+line : 11
+cBeg. : 375
+cEnd. : 376
+line: 12 match: -- --
+action [76] { }
+line: 12 match: --2--
+action [68] { return (new Yytoken(42,yytext(),yyline,yychar,yychar+yylength())); }
+Text : 2
+index : 42
+line : 11
+cBeg. : 377
+cEnd. : 378
+line: 12 match: --;--
+action [31] { return (new Yytoken(2,yytext(),yyline,yychar,yychar+1)); }
+Text : ;
+index : 2
+line : 11
+cBeg. : 378
+cEnd. : 379
+line: 12 match: --
+ --
+action [76] { }
+line: 13 match: --public--
+action [70] { return (new Yytoken(43,yytext(),yyline,yychar,yychar+yylength())); }
+Text : public
+index : 43
+line : 12
+cBeg. : 383
+cEnd. : 389
+line: 13 match: -- --
+action [76] { }
+line: 13 match: --static--
+action [70] { return (new Yytoken(43,yytext(),yyline,yychar,yychar+yylength())); }
+Text : static
+index : 43
+line : 12
+cBeg. : 390
+cEnd. : 396
+line: 13 match: -- --
+action [76] { }
+line: 13 match: --final--
+action [70] { return (new Yytoken(43,yytext(),yyline,yychar,yychar+yylength())); }
+Text : final
+index : 43
+line : 12
+cBeg. : 397
+cEnd. : 402
+line: 13 match: -- --
+action [76] { }
+line: 13 match: --int--
+action [70] { return (new Yytoken(43,yytext(),yyline,yychar,yychar+yylength())); }
+Text : int
+index : 43
+line : 12
+cBeg. : 403
+cEnd. : 406
+line: 13 match: -- --
+action [76] { }
+line: 13 match: --E_UNMATCHED--
+action [70] { return (new Yytoken(43,yytext(),yyline,yychar,yychar+yylength())); }
+Text : E_UNMATCHED
+index : 43
+line : 12
+cBeg. : 407
+cEnd. : 418
+line: 13 match: -- --
+action [76] { }
+line: 13 match: --=--
+action [43] { return (new Yytoken(14,yytext(),yyline,yychar,yychar+1)); }
+Text : =
+index : 14
+line : 12
+cBeg. : 419
+cEnd. : 420
+line: 13 match: -- --
+action [76] { }
+line: 13 match: --3--
+action [68] { return (new Yytoken(42,yytext(),yyline,yychar,yychar+yylength())); }
+Text : 3
+index : 42
+line : 12
+cBeg. : 421
+cEnd. : 422
+line: 13 match: --;--
+action [31] { return (new Yytoken(2,yytext(),yyline,yychar,yychar+1)); }
+Text : ;
+index : 2
+line : 12
+cBeg. : 422
+cEnd. : 423
+line: 13 match: --
+
+ --
+action [76] { }
+line: 15 match: --public--
+action [70] { return (new Yytoken(43,yytext(),yyline,yychar,yychar+yylength())); }
+Text : public
+index : 43
+line : 14
+cBeg. : 428
+cEnd. : 434
+line: 15 match: -- --
+action [76] { }
+line: 15 match: --static--
+action [70] { return (new Yytoken(43,yytext(),yyline,yychar,yychar+yylength())); }
+Text : static
+index : 43
+line : 14
+cBeg. : 435
+cEnd. : 441
+line: 15 match: -- --
+action [76] { }
+line: 15 match: --void--
+action [70] { return (new Yytoken(43,yytext(),yyline,yychar,yychar+yylength())); }
+Text : void
+index : 43
+line : 14
+cBeg. : 442
+cEnd. : 446
+line: 15 match: -- --
+action [76] { }
+line: 15 match: --error--
+action [70] { return (new Yytoken(43,yytext(),yyline,yychar,yychar+yylength())); }
+Text : error
+index : 43
+line : 14
+cBeg. : 447
+cEnd. : 452
+line: 15 match: --(--
+action [32] { return (new Yytoken(3,yytext(),yyline,yychar,yychar+1)); }
+Text : (
+index : 3
+line : 14
+cBeg. : 452
+cEnd. : 453
+line: 15 match: --int--
+action [70] { return (new Yytoken(43,yytext(),yyline,yychar,yychar+yylength())); }
+Text : int
+index : 43
+line : 14
+cBeg. : 453
+cEnd. : 456
+line: 15 match: -- --
+action [76] { }
+line: 15 match: --code--
+action [70] { return (new Yytoken(43,yytext(),yyline,yychar,yychar+yylength())); }
+Text : code
+index : 43
+line : 14
+cBeg. : 457
+cEnd. : 461
+line: 15 match: --)--
+action [33] { return (new Yytoken(4,yytext(),yyline,yychar,yychar+1)); }
+Text : )
+index : 4
+line : 14
+cBeg. : 461
+cEnd. : 462
+line: 15 match: -- --
+action [76] { }
+line: 15 match: --{--
+action [36] { return (new Yytoken(7,yytext(),yyline,yychar,yychar+1)); }
+Text : {
+index : 7
+line : 14
+cBeg. : 463
+cEnd. : 464
+line: 15 match: --
+ --
+action [76] { }
+line: 16 match: --System--
+action [70] { return (new Yytoken(43,yytext(),yyline,yychar,yychar+yylength())); }
+Text : System
+index : 43
+line : 15
+cBeg. : 468
+cEnd. : 474
+line: 16 match: --.--
+action [38] { return (new Yytoken(9,yytext(),yyline,yychar,yychar+1)); }
+Text : .
+index : 9
+line : 15
+cBeg. : 474
+cEnd. : 475
+line: 16 match: --out--
+action [70] { return (new Yytoken(43,yytext(),yyline,yychar,yychar+yylength())); }
+Text : out
+index : 43
+line : 15
+cBeg. : 475
+cEnd. : 478
+line: 16 match: --.--
+action [38] { return (new Yytoken(9,yytext(),yyline,yychar,yychar+1)); }
+Text : .
+index : 9
+line : 15
+cBeg. : 478
+cEnd. : 479
+line: 16 match: --println--
+action [70] { return (new Yytoken(43,yytext(),yyline,yychar,yychar+yylength())); }
+Text : println
+index : 43
+line : 15
+cBeg. : 479
+cEnd. : 486
+line: 16 match: --(--
+action [32] { return (new Yytoken(3,yytext(),yyline,yychar,yychar+1)); }
+Text : (
+index : 3
+line : 15
+cBeg. : 486
+cEnd. : 487
+line: 16 match: --errorMsg--
+action [70] { return (new Yytoken(43,yytext(),yyline,yychar,yychar+yylength())); }
+Text : errorMsg
+index : 43
+line : 15
+cBeg. : 487
+cEnd. : 495
+line: 16 match: --[--
+action [34] { return (new Yytoken(5,yytext(),yyline,yychar,yychar+1)); }
+Text : [
+index : 5
+line : 15
+cBeg. : 495
+cEnd. : 496
+line: 16 match: --code--
+action [70] { return (new Yytoken(43,yytext(),yyline,yychar,yychar+yylength())); }
+Text : code
+index : 43
+line : 15
+cBeg. : 496
+cEnd. : 500
+line: 16 match: --]--
+action [35] { return (new Yytoken(6,yytext(),yyline,yychar,yychar+1)); }
+Text : ]
+index : 6
+line : 15
+cBeg. : 500
+cEnd. : 501
+line: 16 match: --)--
+action [33] { return (new Yytoken(4,yytext(),yyline,yychar,yychar+1)); }
+Text : )
+index : 4
+line : 15
+cBeg. : 501
+cEnd. : 502
+line: 16 match: --;--
+action [31] { return (new Yytoken(2,yytext(),yyline,yychar,yychar+1)); }
+Text : ;
+index : 2
+line : 15
+cBeg. : 502
+cEnd. : 503
+line: 16 match: --
+ --
+action [76] { }
+line: 17 match: --}--
+action [37] { return (new Yytoken(8,yytext(),yyline,yychar,yychar+1)); }
+Text : }
+index : 8
+line : 16
+cBeg. : 506
+cEnd. : 507
+line: 17 match: --
+--
+action [76] { }
+line: 18 match: --}--
+action [37] { return (new Yytoken(8,yytext(),yyline,yychar,yychar+1)); }
+Text : }
+index : 8
+line : 17
+cBeg. : 508
+cEnd. : 509
+line: 18 match: --
+
+--
+action [76] { }
+null
Index: /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/examples/simple/simple.flex
===================================================================
--- /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/examples/simple/simple.flex (revision 25585)
+++ /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/examples/simple/simple.flex (revision 25585)
@@ -0,0 +1,86 @@
+/* this is the scanner example from the JLex website
+ (with small modifications to make it more readable) */
+
+%%
+
+%{
+ private int comment_count = 0;
+%}
+
+%line
+%char
+%state COMMENT
+%full
+
+%debug
+
+ALPHA=[A-Za-z]
+DIGIT=[0-9]
+NONNEWLINE_WHITE_SPACE_CHAR=[\ \t\b\012]
+NEWLINE=\r|\n|\r\n
+WHITE_SPACE_CHAR=[\n\r\ \t\b\012]
+STRING_TEXT=(\\\"|[^\n\r\"]|\\{WHITE_SPACE_CHAR}+\\)*
+COMMENT_TEXT=([^*/\n]|[^*\n]"/"[^*\n]|[^/\n]"*"[^/\n]|"*"[^/\n]|"/"[^*\n])*
+Ident = {ALPHA}({ALPHA}|{DIGIT}|_)*
+
+%%
+
+ {
+ "," { return (new Yytoken(0,yytext(),yyline,yychar,yychar+1)); }
+ ":" { return (new Yytoken(1,yytext(),yyline,yychar,yychar+1)); }
+ ";" { return (new Yytoken(2,yytext(),yyline,yychar,yychar+1)); }
+ "(" { return (new Yytoken(3,yytext(),yyline,yychar,yychar+1)); }
+ ")" { return (new Yytoken(4,yytext(),yyline,yychar,yychar+1)); }
+ "[" { return (new Yytoken(5,yytext(),yyline,yychar,yychar+1)); }
+ "]" { return (new Yytoken(6,yytext(),yyline,yychar,yychar+1)); }
+ "{" { return (new Yytoken(7,yytext(),yyline,yychar,yychar+1)); }
+ "}" { return (new Yytoken(8,yytext(),yyline,yychar,yychar+1)); }
+ "." { return (new Yytoken(9,yytext(),yyline,yychar,yychar+1)); }
+ "+" { return (new Yytoken(10,yytext(),yyline,yychar,yychar+1)); }
+ "-" { return (new Yytoken(11,yytext(),yyline,yychar,yychar+1)); }
+ "*" { return (new Yytoken(12,yytext(),yyline,yychar,yychar+1)); }
+ "/" { return (new Yytoken(13,yytext(),yyline,yychar,yychar+1)); }
+ "=" { return (new Yytoken(14,yytext(),yyline,yychar,yychar+1)); }
+ "<>" { return (new Yytoken(15,yytext(),yyline,yychar,yychar+2)); }
+ "<" { return (new Yytoken(16,yytext(),yyline,yychar,yychar+1)); }
+ "<=" { return (new Yytoken(17,yytext(),yyline,yychar,yychar+2)); }
+ ">" { return (new Yytoken(18,yytext(),yyline,yychar,yychar+1)); }
+ ">=" { return (new Yytoken(19,yytext(),yyline,yychar,yychar+2)); }
+ "&" { return (new Yytoken(20,yytext(),yyline,yychar,yychar+1)); }
+ "|" { return (new Yytoken(21,yytext(),yyline,yychar,yychar+1)); }
+ ":=" { return (new Yytoken(22,yytext(),yyline,yychar,yychar+2)); }
+
+ {NONNEWLINE_WHITE_SPACE_CHAR}+ { }
+
+ "/*" { yybegin(COMMENT); comment_count++; }
+
+ \"{STRING_TEXT}\" {
+ String str = yytext().substring(1,yylength()-1);
+ return (new Yytoken(40,str,yyline,yychar,yychar+yylength()));
+ }
+
+ \"{STRING_TEXT} {
+ String str = yytext().substring(1,yytext().length());
+ Utility.error(Utility.E_UNCLOSEDSTR);
+ return (new Yytoken(41,str,yyline,yychar,yychar + str.length()));
+ }
+
+ {DIGIT}+ { return (new Yytoken(42,yytext(),yyline,yychar,yychar+yylength())); }
+
+ {Ident} { return (new Yytoken(43,yytext(),yyline,yychar,yychar+yylength())); }
+}
+
+ {
+ "/*" { comment_count++; }
+ "*/" { if (--comment_count == 0) yybegin(YYINITIAL); }
+ {COMMENT_TEXT} { }
+}
+
+
+{NEWLINE} { }
+
+. {
+ System.out.println("Illegal character: <" + yytext() + ">");
+ Utility.error(Utility.E_UNMATCHED);
+}
+
Index: /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/examples/simple/test.txt
===================================================================
--- /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/examples/simple/test.txt (revision 25585)
+++ /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/examples/simple/test.txt (revision 25585)
@@ -0,0 +1,19 @@
+class Utility {
+
+ private static final String errorMsg[] = {
+ "Error: Unmatched end-of-comment punctuation.",
+ "Error: Unmatched start-of-comment punctuation.",
+ "Error: Unclosed string.",
+ "Error: Illegal character."
+ };
+
+ public static final int E_ENDCOMMENT = 0;
+ public static final int E_STARTCOMMENT = 1;
+ public static final int E_UNCLOSEDSTR = 2;
+ public static final int E_UNMATCHED = 3;
+
+ public static void error(int code) {
+ System.out.println(errorMsg[code]);
+ }
+}
+
Index: /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/examples/standalone-maven/pom.xml
===================================================================
--- /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/examples/standalone-maven/pom.xml (revision 25585)
+++ /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/examples/standalone-maven/pom.xml (revision 25585)
@@ -0,0 +1,24 @@
+
+
+ 4.0.0
+
+ de.flex.examples
+ parent
+ 1
+
+ standalone-maven
+ 0.1
+ A standalone test substitution scanner
+ This is a small example of a standalone text substitution scanner.
+
+It reads a name after the keyword name and replaces all occurences
+of "hello" by "hello <name> !".</name>
+
+
+ junit
+ junit
+ test
+
+
+
+
Index: /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/examples/standalone-maven/src/main/jflex/standalone.flex
===================================================================
--- /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/examples/standalone-maven/src/main/jflex/standalone.flex (revision 25585)
+++ /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/examples/standalone-maven/src/main/jflex/standalone.flex (revision 25585)
@@ -0,0 +1,45 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright (C) 1998-2009 Gerwin Klein *
+ * All rights reserved. *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License. See the file *
+ * COPYRIGHT for more information. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License along *
+ * with this program; if not, write to the Free Software Foundation, Inc., *
+ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *
+ * *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+
+/**
+ This is a small example of a standalone text substitution scanner
+ It reads a name after the keyword name and substitutes all occurences
+ of "hello" with "hello !". There is a sample input file
+ "sample.inp" provided in this directory
+*/
+
+package de.jflex.example.standalone;
+
+%%
+
+%public
+%class Subst
+%standalone
+
+%unicode
+
+%{
+ String name;
+%}
+
+%%
+
+"name " [a-zA-Z]+ { name = yytext().substring(5); }
+[Hh] "ello" { System.out.print(yytext()+" "+name+"!"); }
Index: /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/examples/standalone-maven/src/test/java/de/jflex/example/standalone/SubstTest.java
===================================================================
--- /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/examples/standalone-maven/src/test/java/de/jflex/example/standalone/SubstTest.java (revision 25585)
+++ /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/examples/standalone-maven/src/test/java/de/jflex/example/standalone/SubstTest.java (revision 25585)
@@ -0,0 +1,46 @@
+package de.jflex.example.standalone;
+
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.FileReader;
+import java.io.IOException;
+import java.io.PrintStream;
+import java.io.Reader;
+import junit.framework.TestCase;
+
+
+
+public class SubstTest extends TestCase {
+ private static final String OUTPUT_FILE = "target/sample.out";
+
+ public void testSample() throws IOException {
+ // the standalon Subst prints status on stdout
+ // redirecte it into a file
+ String[] argv = new String[1];
+ argv[0] = "src/test/resources/sample.in";
+ File actual = new File(OUTPUT_FILE);
+ actual.delete();
+ FileOutputStream fos = new FileOutputStream(OUTPUT_FILE, true);
+ System.setOut(new PrintStream(fos));
+
+ Subst.main(argv);
+
+ fos.close();
+
+ BufferedReader actualContent = new BufferedReader(new FileReader(
+ actual));
+
+ // the expected result is in a file
+ Reader expected = new FileReader("src/test/resources/sample.expected");
+ BufferedReader expectedContent = new BufferedReader(expected);
+
+ String expectedLine, actualLine;
+ do {
+ expectedLine = expectedContent.readLine();
+ actualLine = actualContent.readLine();
+
+ assertEquals(expectedLine, actualLine);
+ } while (expectedLine != null);
+ }
+}
Index: /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/examples/standalone-maven/src/test/resources/sample.expected
===================================================================
--- /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/examples/standalone-maven/src/test/resources/sample.expected (revision 25585)
+++ /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/examples/standalone-maven/src/test/resources/sample.expected (revision 25585)
@@ -0,0 +1,8 @@
+
+
+Hello someone!
+This is a sample input file for the
+standalone example scanner.
+
+Have a nice day!
+
Index: /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/examples/standalone-maven/src/test/resources/sample.in
===================================================================
--- /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/examples/standalone-maven/src/test/resources/sample.in (revision 25585)
+++ /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/examples/standalone-maven/src/test/resources/sample.in (revision 25585)
@@ -0,0 +1,8 @@
+name someone
+
+Hello
+This is a sample input file for the
+standalone example scanner.
+
+Have a nice day!
+
Index: /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/examples/standalone/Makefile
===================================================================
--- /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/examples/standalone/Makefile (revision 25585)
+++ /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/examples/standalone/Makefile (revision 25585)
@@ -0,0 +1,13 @@
+all: run
+
+run: Subst.class
+ java Subst sample.inp
+
+Subst.class: Subst.java
+ javac Subst.java
+
+Subst.java: standalone.flex
+ jflex standalone.flex
+
+clean:
+ rm -rf *.class *~ *.java
Index: /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/examples/standalone/README
===================================================================
--- /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/examples/standalone/README (revision 25585)
+++ /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/examples/standalone/README (revision 25585)
@@ -0,0 +1,20 @@
+This is a small example of a standalone text substitution scanner.
+
+It reads a name after the keyword name and replaces all occurences
+of "hello" by "hello !".
+
+sample.inp
+ contains a sample input for the scanner
+
+standalone.flex
+ the lexical specification for the scanner
+
+build.xml
+ ant build file
+
+to run the example use ant or type:
+
+jflex standalone.flex
+javac Subst.java
+java Subst sample.inp
+
Index: /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/examples/standalone/build.xml
===================================================================
--- /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/examples/standalone/build.xml (revision 25585)
+++ /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/examples/standalone/build.xml (revision 25585)
@@ -0,0 +1,23 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Index: /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/examples/standalone/sample.inp
===================================================================
--- /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/examples/standalone/sample.inp (revision 25585)
+++ /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/examples/standalone/sample.inp (revision 25585)
@@ -0,0 +1,8 @@
+name someone
+
+Hello
+This is a sample input file for the
+standalone example scanner.
+
+Have a nice day!
+
Index: /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/examples/standalone/standalone.flex
===================================================================
--- /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/examples/standalone/standalone.flex (revision 25585)
+++ /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/examples/standalone/standalone.flex (revision 25585)
@@ -0,0 +1,44 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright (C) 1998-2009 Gerwin Klein *
+ * All rights reserved. *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License. See the file *
+ * COPYRIGHT for more information. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License along *
+ * with this program; if not, write to the Free Software Foundation, Inc., *
+ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *
+ * *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+
+/**
+ This is a small example of a standalone text substitution scanner
+ It reads a name after the keyword name and substitutes all occurences
+ of "hello" with "hello !". There is a sample input file
+ "sample.inp" provided in this directory
+*/
+
+%%
+
+%public
+%class Subst
+%standalone
+
+%unicode
+
+%{
+ String name;
+%}
+
+%%
+
+"name " [a-zA-Z]+ { name = yytext().substring(5); }
+[Hh] "ello" { System.out.print(yytext()+" "+name+"!"); }
+
Index: /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/lib/jflex-mode.el
===================================================================
--- /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/lib/jflex-mode.el (revision 25585)
+++ /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/lib/jflex-mode.el (revision 25585)
@@ -0,0 +1,114 @@
+; -*- Mode: Emacs-Lisp; -*-
+
+;;; jflex-mode
+
+;;; author: Gerwin Klein
+;;; $Revision: 50 $, $Date: 2003-06-08 21:01:12 +1000 (Sun, 08 Jun 2003) $
+
+(require 'derived)
+(require 'font-lock)
+
+(define-derived-mode jflex-mode java-mode "JFlex"
+ "Major mode for editing JFlex files"
+
+ ;; set the indentation
+ (setq c-basic-offset 2)
+
+ (c-set-offset 'knr-argdecl-intro 0)
+ (c-set-offset 'topmost-intro-cont 0)
+
+ ;; remove auto and hungry anything
+ (c-toggle-auto-hungry-state -1)
+ (c-toggle-auto-state -1)
+ (c-toggle-hungry-state -1)
+
+ (use-local-map jflex-mode-map)
+
+ ;; get rid of that damn electric-brace
+ (define-key jflex-mode-map "{" 'self-insert-command)
+ (define-key jflex-mode-map "}" 'self-insert-command)
+
+ (define-key jflex-mode-map [tab] 'jflex-indent-command)
+
+ )
+
+(defalias 'jflex-indent-command 'c-indent-command)
+
+(defconst jflex-font-lock-keywords
+ (append
+ '(
+ ("^%%" . font-lock-reference-face)
+ "^%{"
+ "^%init{"
+ "^%initthrow{"
+ "^%eof{"
+ "^%eofthrow{"
+ "^%yylexthrow{"
+ "^%eofval{"
+ "^%}"
+ "^%init}"
+ "^%initthrow}"
+ "^%eof}"
+ "^%eofthrow}"
+ "^%yylexthrow}"
+ "^%eofval}"
+ "^%standalone"
+ "^%scanerror"
+ "^%switch"
+ "^%states" ; fixme: state identifiers
+ "^%state"
+ "^%s"
+ "^%xstates"
+ "^%xstate"
+ "^%x"
+ "^%char"
+ "^%line"
+ "^%column"
+ "^%byaccj"
+ "^%cupsym"
+ "^%cupdebug"
+ "^%cup"
+ "^%eofclose"
+ "^%class"
+ "^%function"
+ "^%type"
+ "^%integer"
+ "^%intwrap"
+ "^%int"
+ "^%yyeof"
+ "^%notunix"
+ "^%7bit"
+ "^%full"
+ "^%8bit"
+ "^%unicode"
+ "^%16bit"
+ "^%caseless"
+ "^%ignorecase"
+ "^%implements"
+ "^%extends"
+ "^%public"
+ "^%apiprivate"
+ "^%final"
+ "^%abstract"
+ "^%debug"
+ "^%table"
+ "^%pack"
+ "^%include"
+ "^%buffer"
+ "^%initthrow"
+ "^%eofthrow"
+ "^%yylexthrow"
+ "^%throws"
+ ("%[%{}0-9a-zA-Z]+" . font-lock-warning-face) ; errors
+ ("{[ \t]*[a-zA-Z][0-9a-zA-Z_]+[ \t]*}" . font-lock-variable-name-face) ; macro uses
+ "<>" ; special <> symbol
+ ("<[ \t]*[a-zA-Z][0-9a-zA-Z_]+[ \t]*\\(,[ \t]*[a-zA-Z][0-9a-zA-Z_]+[ \t]*\\)*>" . font-lock-type-face) ; lex state list
+ )
+ java-font-lock-keywords-2)
+ "JFlex keywords for font-lock mode")
+
+(put 'jflex-mode 'font-lock-defaults
+ '(jflex-font-lock-keywords
+ nil nil ((?_ . "w")) beginning-of-defun))
+
+(provide 'jflex-mode)
Index: /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/lib/jflex.vim
===================================================================
--- /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/lib/jflex.vim (revision 25585)
+++ /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/lib/jflex.vim (revision 25585)
@@ -0,0 +1,149 @@
+" Vim syntax file
+" Language: JFlex
+" Maintainer: Gerwin Klein
+" Last Change: $Revision: 50 $, $Date: 2003-06-08 21:01:12 +1000 (Sun, 08 Jun 2003) $
+
+" Thanks to Michael Brailsford for help and suggestions
+
+" Quit when a syntax file was already loaded {{{
+if exists("b:current_syntax")
+ finish
+endif
+"}}}
+
+" Include java syntax {{{
+if version >= 600
+ runtime! syntax/java.vim
+ unlet b:current_syntax
+else
+ so $VIMRUNTIME/syntax/java.vim
+endif
+"}}}
+
+syn cluster jflexOptions contains=jflexOption,jflexCodeInclude,jflexComment,jflexMacroIdent,jflexMacroRegExp,jflexOptionError
+syn cluster jflexRules contains=jflexRule,jflexComment,jflexActionCode,jflexRuleStates,jflexRegExp
+
+" java code section
+syn region jflexStart start="/\*\|//\|import\|package\|class"me=s end="^%%"me=e-2 contains=@javaTop nextgroup=jflexOptionReg
+
+" %%
+" options
+syn region jflexOptionReg matchgroup=jflexSectionSep start="^%%" end="^%%"me=e-2 contains=@jflexOptions nextgroup=jflexRulesReg
+
+syn match jflexOptionError "%\i*" contained
+
+syn match jflexOption "^\(%s\|%x\)" contained
+syn match jflexOption "^%state" contained
+syn match jflexOption "^%states" contained
+syn match jflexOption "^%xstate" contained
+syn match jflexOption "^%xstates" contained
+syn match jflexOption "^%char" contained
+syn match jflexOption "^%line" contained
+syn match jflexOption "^%column" contained
+syn match jflexOption "^%byaccj" contained
+syn match jflexOption "^%cup" contained
+syn match jflexOption "^%cupsym" contained
+syn match jflexOption "^%cupdebug" contained
+syn match jflexOption "^%eofclose" contained
+syn match jflexOption "^%class" contained
+syn match jflexOption "^%function" contained
+syn match jflexOption "^%type" contained
+syn match jflexOption "^%integer" contained
+syn match jflexOption "^%int" contained
+syn match jflexOption "^%intwrap" contained
+syn match jflexOption "^%yyeof" contained
+syn match jflexOption "^%notunix" contained
+syn match jflexOption "^%7bit" contained
+syn match jflexOption "^%8bit" contained
+syn match jflexOption "^%full" contained
+syn match jflexOption "^%16bit" contained
+syn match jflexOption "^%unicode" contained
+syn match jflexOption "^%caseless" contained
+syn match jflexOption "^%ignorecase" contained
+syn match jflexOption "^%implements" contained
+syn match jflexOption "^%extends" contained
+syn match jflexOption "^%public" contained
+syn match jflexOption "^%apiprivate" contained
+syn match jflexOption "^%final" contained
+syn match jflexOption "^%abstract" contained
+syn match jflexOption "^%debug" contained
+syn match jflexOption "^%standalone" contained
+syn match jflexOption "^%switch" contained
+syn match jflexOption "^%table" contained
+syn match jflexOption "^%pack" contained
+syn match jflexOption "^%include" contained
+syn match jflexOption "^%buffer" contained
+syn match jflexOption "^%initthrow" contained
+syn match jflexOption "^%eofthrow" contained
+syn match jflexOption "^%yylexthrow" contained
+syn match jflexOption "^%throws" contained
+syn match jflexOption "^%scannerror" contained
+
+syn match jflexMacroIdent "\I\i*\s*="me=e-1 contained nextgroup=jflexMacroRegExp
+
+syn region jflexMacroRegExp matchgroup=jflexOperator start="=" end="^\(%\|\I\|\i\|/\)"me=e-1 contains=NONE contained
+
+syn region jflexCodeInclude matchgroup=jflexCodeIncludeMark start="^%{" end="^%}" contains=@javaTop contained
+syn region jflexCodeInclude matchgroup=jflexCodeIncludeMark start="^%init{" end="^%init}" contains=@javaTop contained
+syn region jflexCodeInclude matchgroup=jflexCodeIncludeMark start="^%initthrow{" end="^%initthrow}" contains=@javaTop contained
+syn region jflexCodeInclude matchgroup=jflexCodeIncludeMark start="^%eof{" end="^%eof}" contains=@javaTop contained
+syn region jflexCodeInclude matchgroup=jflexCodeIncludeMark start="^%eofthrow{" end="^%eofthrow}" contains=@javaTop contained
+syn region jflexCodeInclude matchgroup=jflexCodeIncludeMark start="^%yylexthrow{" end="^%yylexthrow}" contains=@javaTop contained
+syn region jflexCodeInclude matchgroup=jflexCodeIncludeMark start="^%eofval{" end="^%eofval}" contains=@javaTop contained
+
+" rules (end pattern shouldn't occur, if it does anyway we just stay in jflexRulesReg)
+syn region jflexRulesReg matchgroup=jflexSectionSep start="^%%" end="^%%"me=e-2 contains=@jflexRules
+
+" at first everything but strings is a regexp
+syn match jflexRegExp "\([^\" \t]\|\\\"\)\+" contained
+
+" take out comments
+syn match jflexComment "//.*" contained
+syn region jflexComment start="/\*" end="\*/" contained contains=jflexComment
+
+" lex states
+syn match jflexRuleStates "<\s*\I\i*\(\s*,\s*\I\i*\)*\s*>" contained skipnl skipwhite nextgroup=jflexStateGroup
+
+" action code (only after states braces and macro use)
+syn region jflexActionCode matchgroup=Delimiter start="{" end="}" contained contains=@javaTop,jflexJavaBraces
+
+" macro use
+syn match jflexRegExp "{\s*\I\i*\s*}" contained
+
+" state braces (only active after )
+syn region jflexStateGroup matchgroup=jflexRuleStates start="{$" start="{\s" end="}" contained contains=@jflexRules
+
+" string
+syn region jflexRegExp matchgroup=String start=+"+ skip=+\\\\\|\\"+ end=+"+ contained
+
+" not to be confused with a state
+syn match jflexRegExp "<>" contained
+
+" escape sequence
+syn match jflexRegExp "\\." contained
+
+
+" keep braces in actions balanced
+syn region jflexJavaBraces start="{" end="}" contained contains=@javaTop,jflexJavaBraces
+
+
+" syncing
+syn sync clear
+syn sync minlines=10
+syn sync match jflexSync grouphere jflexOptionReg "^%[a-z]"
+syn sync match jflexSync grouphere jflexRulesReg "^<"
+
+
+" highlighting
+hi link jflexOption Special
+hi link jflexMacroIdent Ident
+hi link jflexMacroRegExp Macro
+hi link jflexOptionError Error
+hi link jflexComment Comment
+hi link jflexOperator Operator
+hi link jflexRuleStates Special
+hi link jflexRegExp Function
+hi jflexSectionSep guifg=yellow ctermfg=yellow guibg=blue ctermbg=blue gui=bold cterm=bold
+hi link jflexCodeIncludeMark jflexSectionSep
+
+let b:current_syntax="jflex"
Index: /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/src/JFlex/Action.java
===================================================================
--- /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/src/JFlex/Action.java (revision 25585)
+++ /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/src/JFlex/Action.java (revision 25585)
@@ -0,0 +1,261 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * JFlex 1.4.3 *
+ * Copyright (C) 1998-2009 Gerwin Klein *
+ * All rights reserved. *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License. See the file *
+ * COPYRIGHT for more information. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License along *
+ * with this program; if not, write to the Free Software Foundation, Inc., *
+ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *
+ * *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+package JFlex;
+
+
+/**
+ * Encapsulates an action in the specification.
+ *
+ * It stores the Java code as String together with a priority (line number in the specification).
+ *
+ * @author Gerwin Klein
+ * @version JFlex 1.4.3, $Revision: 433 $, $Date: 2009-01-31 19:52:34 +1100 (Sat, 31 Jan 2009) $
+ */
+final public class Action {
+
+ /** A normal action */
+ public final static int NORMAL = 0;
+ /** Action of a lookahead expression r1/r2 with fixed length r1 */
+ public final static int FIXED_BASE = 1;
+ /** Action of a lookahead expression r1/r2 with fixed length r2 */
+ public final static int FIXED_LOOK = 2;
+ /** Action of a lookahead expression r1/r2 with a finite choice of
+ * fixed lengths in r2 */
+ public final static int FINITE_CHOICE = 3;
+ /** Action of a general lookahead expression */
+ public final static int GENERAL_LOOK = 4;
+ /** Action of the 2nd forward pass for lookahead */
+ public final static int FORWARD_ACTION = 5;
+ /** Action of the backward pass for lookahead */
+ public final static int BACKWARD_ACTION = 6;
+
+ /**
+ * The Java code this Action represents
+ */
+ String content;
+
+ /**
+ * The priority (i.e. line number in the specification) of this Action.
+ */
+ int priority;
+
+ /**
+ * Which kind of action this is.
+ * (normal, a/b
with fixed length a, fixed length b, etc)
+ */
+ private int kind = NORMAL;
+
+ /** The length of the lookahead (if fixed) */
+ private int len;
+
+ /** The entry state of the corresponding forward DFA (if general lookahead) */
+ private int entryState;
+
+ /**
+ * Creates a new Action object with specified content and line number.
+ *
+ * @param content java code
+ * @param priority line number
+ */
+ public Action(String content, int priority) {
+ this.content = content.trim();
+ this.priority = priority;
+ }
+
+ /**
+ * Creates a new Action object of the specified kind. Only
+ * accepts FORWARD_ACTION or BACKWARD_ACTION.
+ *
+ * @param kind the kind of action
+ *
+ * @see #FORWARD_ACTION
+ * @see #BACKWARD_ACTION
+ */
+ public Action(int kind) {
+ if (kind != FORWARD_ACTION && kind != BACKWARD_ACTION)
+ throw new GeneratorException();
+ this.content = "";
+ this.priority = Integer.MAX_VALUE;
+ this.kind = kind;
+ }
+
+ /**
+ * Compares the priority value of this Action with the specified action.
+ *
+ * @param other the other Action to compare this Action with.
+ *
+ * @return this Action if it has higher priority - the specified one, if not.
+ */
+ public Action getHigherPriority(Action other) {
+ if (other == null) return this;
+
+ // the smaller the number the higher the priority
+ if (other.priority > this.priority)
+ return this;
+ else
+ return other;
+ }
+
+
+ /**
+ * Returns the String representation of this object.
+ *
+ * @return string representation of the action
+ */
+ public String toString() {
+ return "Action (priority "+priority+", lookahead "+kind+") :" +
+ Out.NL+content; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ }
+
+
+ /**
+ * Returns true
iff the parameter is an
+ * Action with the same content as this one.
+ *
+ * @param a the object to compare this Action with
+ * @return true if the action strings are equal
+ */
+ public boolean isEquiv(Action a) {
+ return this == a ||
+ (this.content.equals(a.content) &&
+ this.kind == a.kind &&
+ this.len == a.len &&
+ this.entryState == a.entryState);
+ }
+
+
+ /**
+ * Calculate hash value.
+ *
+ * @return a hash value for this Action
+ */
+ public int hashCode() {
+ return content.hashCode();
+ }
+
+
+ /**
+ * Test for equality to another object.
+ *
+ * This action equals another object if the other
+ * object is an equivalent action.
+ *
+ * @param o the other object.
+ *
+ * @see Action#isEquiv(Action)
+ */
+ public boolean equals(Object o) {
+ if (o instanceof Action)
+ return isEquiv((Action) o);
+ else
+ return false;
+ }
+
+ /**
+ * Return true iff this is action belongs to a general lookahead rule.
+ *
+ * @return true if this actions belongs to a general lookahead rule.
+ */
+ public boolean isGenLookAction() {
+ return kind == GENERAL_LOOK;
+ }
+
+ /**
+ * Return true if code for this is action should be emitted, false
+ * if it is a BACK/FORWARD lookahead action.
+ *
+ * @return true if code should be emitted for this action.
+ */
+ public boolean isEmittable() {
+ return kind != BACKWARD_ACTION && kind != FORWARD_ACTION;
+ }
+
+ /**
+ * Return kind of lookahead.
+ */
+ public int lookAhead() {
+ return kind;
+ }
+
+ /**
+ * Sets the lookahead kind and data for this action
+ *
+ * @param kind which kind of lookahead it is
+ * @param data the length for fixed length look aheads.
+ *
+ */
+ public void setLookAction(int kind, int data) {
+ this.kind = kind;
+ this.len = data;
+ }
+
+ /**
+ * The length of the lookahead or base if this is a fixed length
+ * lookahead action.
+ */
+ public int getLookLength() {
+ return len;
+ }
+
+ /**
+ * Return the corresponding entry state for the forward DFA (if this
+ * is a general lookahead expression)
+ *
+ * @return the forward DFA entry state (+1 is the backward DFA)
+ */
+ public int getEntryState() {
+ return entryState;
+ }
+
+ /**
+ * Set the corresponding entry state for the forward DFA of this action
+ * (if this is a general lookahead expression)
+ *
+ * @param the entry state for the forward DFA of this action
+ */
+ public void setEntryState(int entryState) {
+ this.entryState = entryState;
+ }
+
+ public Action copyChoice(int length) {
+ Action a = new Action(this.content, this.priority);
+ a.setLookAction(FINITE_CHOICE, length);
+ return a;
+ }
+
+ /**
+ * String representation of the lookahead kind of this action.
+ *
+ * @return the string representation
+ */
+ public String lookString() {
+ switch (kind) {
+ case NORMAL: return "";
+ case BACKWARD_ACTION: return "LOOK_BACK";
+ case FIXED_BASE: return "FIXED_BASE";
+ case FIXED_LOOK: return "FIXED_LOOK";
+ case FINITE_CHOICE: return "FINITE_CHOICE";
+ case FORWARD_ACTION: return "LOOK_FORWARD";
+ case GENERAL_LOOK: return "LOOK_ACTION";
+ default: return "unknown lookahead type";
+ }
+ }
+}
Index: /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/src/JFlex/CharClassException.java
===================================================================
--- /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/src/JFlex/CharClassException.java (revision 25585)
+++ /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/src/JFlex/CharClassException.java (revision 25585)
@@ -0,0 +1,49 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * JFlex 1.4.3 *
+ * Copyright (C) 1998-2009 Gerwin Klein *
+ * All rights reserved. *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License. See the file *
+ * COPYRIGHT for more information. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License along *
+ * with this program; if not, write to the Free Software Foundation, Inc., *
+ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *
+ * *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+package JFlex;
+
+
+
+/**
+ * This Exception is used in class CharClasses.
+ *
+ * @author Gerwin Klein
+ * @version JFlex 1.4.3, $Revision: 433 $, $Date: 2009-01-31 19:52:34 +1100 (Sat, 31 Jan 2009) $
+ */
+public class CharClassException extends RuntimeException {
+
+ /**
+ * Creates a new CharClassException without message
+ */
+ public CharClassException() {
+ }
+
+
+ /**
+ * Creates a new CharClassException with the specified message
+ *
+ * @param message the error description presented to the user.
+ */
+ public CharClassException(String message) {
+ super(message);
+ }
+
+}
Index: /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/src/JFlex/CharClassInterval.java
===================================================================
--- /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/src/JFlex/CharClassInterval.java (revision 25585)
+++ /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/src/JFlex/CharClassInterval.java (revision 25585)
@@ -0,0 +1,73 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * JFlex 1.4.3 *
+ * Copyright (C) 1998-2009 Gerwin Klein *
+ * All rights reserved. *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License. See the file *
+ * COPYRIGHT for more information. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License along *
+ * with this program; if not, write to the Free Software Foundation, Inc., *
+ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *
+ * *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+package JFlex;
+
+/**
+ * Stores an interval of characters together with the character class
+ *
+ * A character belongs to an interval, if its Unicode value is greater than or equal
+ * to the Unicode value of start
and smaller than or euqal to the Unicode
+ * value of end
.
+ *
+ * All characters of the interval must belong to the same character class.
+ *
+ * @author Gerwin Klein
+ * @version JFlex 1.4.3, $Revision: 433 $, $Date: 2009-01-31 19:52:34 +1100 (Sat, 31 Jan 2009) $
+ */
+public class CharClassInterval {
+
+ /**
+ * The first character of the interval
+ */
+ int start;
+
+ /**
+ * The last character of the interval
+ */
+ int end;
+
+ /**
+ * The code of the class all characters of this interval belong to.
+ */
+ int charClass;
+
+
+ /**
+ * Creates a new CharClassInterval from start
to end
+ * that belongs to character class charClass
.
+ *
+ * @param start The first character of the interval
+ * @param end The last character of the interval
+ * @param charClass The code of the class all characters of this interval belong to.
+ */
+ public CharClassInterval(int start, int end, int charClass) {
+ this.start = start;
+ this.end = end;
+ this.charClass = charClass;
+ }
+
+ /**
+ * returns string representation of this class interval
+ */
+ public String toString() {
+ return "["+start+"-"+end+"="+charClass+"]";
+ }
+}
Index: /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/src/JFlex/CharClasses.java
===================================================================
--- /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/src/JFlex/CharClasses.java (revision 25585)
+++ /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/src/JFlex/CharClasses.java (revision 25585)
@@ -0,0 +1,388 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * JFlex 1.4.3 *
+ * Copyright (C) 1998-2009 Gerwin Klein *
+ * All rights reserved. *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License. See the file *
+ * COPYRIGHT for more information. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License along *
+ * with this program; if not, write to the Free Software Foundation, Inc., *
+ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *
+ * *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+package JFlex;
+
+import java.util.*;
+
+
+/**
+ *
+ * @author Gerwin Klein
+ * @version JFlex 1.4.3, $Revision: 433 $, $Date: 2009-01-31 19:52:34 +1100 (Sat, 31 Jan 2009) $
+ */
+public class CharClasses {
+
+ /** debug flag (for char classes only) */
+ private static final boolean DEBUG = false;
+
+ /** the largest character that can be used in char classes */
+ public static final char maxChar = '\uFFFF';
+
+ /** the char classes */
+ private Vector /* of IntCharSet */ classes;
+
+ /** the largest character actually used in a specification */
+ private char maxCharUsed;
+
+ /**
+ * Constructs a new CharClass object that provides space for
+ * classes of characters from 0 to maxCharCode.
+ *
+ * Initially all characters are in class 0.
+ *
+ * @param maxCharCode the last character code to be
+ * considered. (127 for 7bit Lexers,
+ * 255 for 8bit Lexers and 0xFFFF
+ * for Unicode Lexers).
+ */
+ public CharClasses(int maxCharCode) {
+ if (maxCharCode < 0 || maxCharCode > 0xFFFF)
+ throw new IllegalArgumentException();
+
+ maxCharUsed = (char) maxCharCode;
+
+ classes = new Vector();
+ classes.addElement(new IntCharSet(new Interval((char) 0, maxChar)));
+ }
+
+
+ /**
+ * Returns the greatest Unicode value of the current input character set.
+ */
+ public char getMaxCharCode() {
+ return maxCharUsed;
+ }
+
+
+ /**
+ * Sets the largest Unicode value of the current input character set.
+ *
+ * @param charCode the largest character code, used for the scanner
+ * (i.e. %7bit, %8bit, %16bit etc.)
+ */
+ public void setMaxCharCode(int charCode) {
+ if (charCode < 0 || charCode > 0xFFFF)
+ throw new IllegalArgumentException();
+
+ maxCharUsed = (char) charCode;
+ }
+
+
+ /**
+ * Returns the current number of character classes.
+ */
+ public int getNumClasses() {
+ return classes.size();
+ }
+
+
+
+ /**
+ * Updates the current partition, so that the specified set of characters
+ * gets a new character class.
+ *
+ * Characters that are elements of set
are not in the same
+ * equivalence class with characters that are not elements of set
.
+ *
+ * @param set the set of characters to distinguish from the rest
+ * @param caseless if true upper/lower/title case are considered equivalent
+ */
+ public void makeClass(IntCharSet set, boolean caseless) {
+ if (caseless) set = set.getCaseless();
+
+ if ( DEBUG ) {
+ Out.dump("makeClass("+set+")");
+ dump();
+ }
+
+ int oldSize = classes.size();
+ for (int i = 0; i < oldSize; i++) {
+ IntCharSet x = (IntCharSet) classes.elementAt(i);
+
+ if (x.equals(set)) return;
+
+ IntCharSet and = x.and(set);
+
+ if ( and.containsElements() ) {
+ if ( x.equals(and) ) {
+ set.sub(and);
+ continue;
+ }
+ else if ( set.equals(and) ) {
+ x.sub(and);
+ classes.addElement(and);
+ if (DEBUG) {
+ Out.dump("makeClass(..) finished");
+ dump();
+ }
+ return;
+ }
+
+ set.sub(and);
+ x.sub(and);
+ classes.addElement(and);
+ }
+ }
+
+ if (DEBUG) {
+ Out.dump("makeClass(..) finished");
+ dump();
+ }
+ }
+
+
+ /**
+ * Returns the code of the character class the specified character belongs to.
+ */
+ public int getClassCode(char letter) {
+ int i = -1;
+ while (true) {
+ IntCharSet x = (IntCharSet) classes.elementAt(++i);
+ if ( x.contains(letter) ) return i;
+ }
+ }
+
+ /**
+ * Dump charclasses to the dump output stream
+ */
+ public void dump() {
+ Out.dump(toString());
+ }
+
+
+ /**
+ * Return a string representation of one char class
+ *
+ * @param theClass the index of the class to
+ */
+ public String toString(int theClass) {
+ return classes.elementAt(theClass).toString();
+ }
+
+
+ /**
+ * Return a string representation of the char classes
+ * stored in this class.
+ *
+ * Enumerates the classes by index.
+ */
+ public String toString() {
+ StringBuffer result = new StringBuffer("CharClasses:");
+
+ result.append(Out.NL);
+
+ for (int i = 0; i < classes.size(); i++)
+ result.append("class "+i+":"+Out.NL+classes.elementAt(i)+Out.NL);
+
+ return result.toString();
+ }
+
+
+ /**
+ * Creates a new character class for the single character singleChar
.
+ *
+ * @param caseless if true upper/lower/title case are considered equivalent
+ */
+ public void makeClass(char singleChar, boolean caseless) {
+ makeClass(new IntCharSet(singleChar), caseless);
+ }
+
+
+ /**
+ * Creates a new character class for each character of the specified String.
+ *
+ * @param caseless if true upper/lower/title case are considered equivalent
+ */
+ public void makeClass(String str, boolean caseless) {
+ for (int i = 0; i < str.length(); i++) makeClass(str.charAt(i), caseless);
+ }
+
+
+ /**
+ * Updates the current partition, so that the specified set of characters
+ * gets a new character class.
+ *
+ * Characters that are elements of the set v
are not in the same
+ * equivalence class with characters that are not elements of the set v
.
+ *
+ * @param v a Vector of Interval objects.
+ * This Vector represents a set of characters. The set of characters is
+ * the union of all intervals in the Vector.
+ *
+ * @param caseless if true upper/lower/title case are considered equivalent
+ */
+ public void makeClass(Vector /* Interval */ v, boolean caseless) {
+ makeClass(new IntCharSet(v), caseless);
+ }
+
+
+ /**
+ * Updates the current partition, so that the set of all characters not contained in the specified
+ * set of characters gets a new character class.
+ *
+ * Characters that are elements of the set v
are not in the same
+ * equivalence class with characters that are not elements of the set v
.
+ *
+ * This method is equivalent to makeClass(v)
+ *
+ * @param v a Vector of Interval objects.
+ * This Vector represents a set of characters. The set of characters is
+ * the union of all intervals in the Vector.
+ *
+ * @param caseless if true upper/lower/title case are considered equivalent
+ */
+ public void makeClassNot(Vector v, boolean caseless) {
+ makeClass(new IntCharSet(v), caseless);
+ }
+
+
+ /**
+ * Returns an array that contains the character class codes of all characters
+ * in the specified set of input characters.
+ */
+ private int [] getClassCodes(IntCharSet set, boolean negate) {
+
+ if (DEBUG) {
+ Out.dump("getting class codes for "+set);
+ if (negate)
+ Out.dump("[negated]");
+ }
+
+ int size = classes.size();
+
+ // [fixme: optimize]
+ int temp [] = new int [size];
+ int length = 0;
+
+ for (int i = 0; i < size; i++) {
+ IntCharSet x = (IntCharSet) classes.elementAt(i);
+ if ( negate ) {
+ if ( !set.and(x).containsElements() ) {
+ temp[length++] = i;
+ if (DEBUG) Out.dump("code "+i);
+ }
+ }
+ else {
+ if ( set.and(x).containsElements() ) {
+ temp[length++] = i;
+ if (DEBUG) Out.dump("code "+i);
+ }
+ }
+ }
+
+ int result [] = new int [length];
+ System.arraycopy(temp, 0, result, 0, length);
+
+ return result;
+ }
+
+
+ /**
+ * Returns an array that contains the character class codes of all characters
+ * in the specified set of input characters.
+ *
+ * @param intervallVec a Vector of Intervals, the set of characters to get
+ * the class codes for
+ *
+ * @return an array with the class codes for intervallVec
+ */
+ public int [] getClassCodes(Vector /* Interval */ intervallVec) {
+ return getClassCodes(new IntCharSet(intervallVec), false);
+ }
+
+
+ /**
+ * Returns an array that contains the character class codes of all characters
+ * that are not in the specified set of input characters.
+ *
+ * @param intervallVec a Vector of Intervals, the complement of the
+ * set of characters to get the class codes for
+ *
+ * @return an array with the class codes for the complement of intervallVec
+ */
+ public int [] getNotClassCodes(Vector /* Interval */ intervallVec) {
+ return getClassCodes(new IntCharSet(intervallVec), true);
+ }
+
+
+ /**
+ * Check consistency of the stored classes [debug].
+ *
+ * all classes must be disjoint, checks if all characters
+ * have a class assigned.
+ */
+ public void check() {
+ for (int i = 0; i < classes.size(); i++)
+ for (int j = i+1; j < classes.size(); j++) {
+ IntCharSet x = (IntCharSet) classes.elementAt(i);
+ IntCharSet y = (IntCharSet) classes.elementAt(j);
+ if ( x.and(y).containsElements() ) {
+ System.out.println("Error: non disjoint char classes "+i+" and "+j);
+ System.out.println("class "+i+": "+x);
+ System.out.println("class "+j+": "+y);
+ }
+ }
+
+ // check if each character has a classcode
+ // (= if getClassCode terminates)
+ for (char c = 0; c < maxChar; c++) {
+ getClassCode(c);
+ if (c % 100 == 0) System.out.print(".");
+ }
+
+ getClassCode(maxChar);
+ }
+
+
+ /**
+ * Returns an array of all CharClassIntervalls in this
+ * char class collection.
+ *
+ * The array is ordered by char code, i.e.
+ * result[i+1].start = result[i].end+1
+ *
+ * Each CharClassInterval contains the number of the
+ * char class it belongs to.
+ */
+ public CharClassInterval [] getIntervals() {
+ int i, c;
+ int size = classes.size();
+ int numIntervalls = 0;
+
+ for (i = 0; i < size; i++)
+ numIntervalls+= ((IntCharSet) classes.elementAt(i)).numIntervalls();
+
+ CharClassInterval [] result = new CharClassInterval[numIntervalls];
+
+ i = 0;
+ c = 0;
+ while (i < numIntervalls) {
+ int code = getClassCode((char) c);
+ IntCharSet set = (IntCharSet) classes.elementAt(code);
+ Interval iv = set.getNext();
+
+ result[i++] = new CharClassInterval(iv.start, iv.end, code);
+ c = iv.end+1;
+ }
+
+ return result;
+ }
+}
Index: /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/src/JFlex/CharSet.java
===================================================================
--- /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/src/JFlex/CharSet.java (revision 25585)
+++ /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/src/JFlex/CharSet.java (revision 25585)
@@ -0,0 +1,112 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * JFlex 1.4.3 *
+ * Copyright (C) 1998-2009 Gerwin Klein *
+ * All rights reserved. *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License. See the file *
+ * COPYRIGHT for more information. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License along *
+ * with this program; if not, write to the Free Software Foundation, Inc., *
+ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *
+ * *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+package JFlex;
+
+
+/**
+ *
+ * @author Gerwin Klein
+ * @version JFlex 1.4.3, $Revision: 433 $, $Date: 2009-01-31 19:52:34 +1100 (Sat, 31 Jan 2009) $
+ */
+public final class CharSet {
+
+ final static int BITS = 6; // the number of bits to shift (2^6 = 64)
+ final static int MOD = (1<> BITS)+1];
+ add(character);
+ }
+
+
+ public void add(int character) {
+ resize(character);
+
+ if ( (bits[character >> BITS] & (1L << (character & MOD))) == 0) numElements++;
+
+ bits[character >> BITS] |= (1L << (character & MOD));
+ }
+
+
+ private int nbits2size (int nbits) {
+ return ((nbits >> BITS) + 1);
+ }
+
+
+ private void resize(int nbits) {
+ int needed = nbits2size(nbits);
+
+ if (needed < bits.length) return;
+
+ long newbits[] = new long[Math.max(bits.length*2,needed)];
+ System.arraycopy(bits, 0, newbits, 0, bits.length);
+
+ bits = newbits;
+ }
+
+
+ public boolean isElement(int character) {
+ int index = character >> BITS;
+ if (index >= bits.length) return false;
+ return (bits[index] & (1L << (character & MOD))) != 0;
+ }
+
+
+ public CharSetEnumerator characters() {
+ return new CharSetEnumerator(this);
+ }
+
+
+ public boolean containsElements() {
+ return numElements > 0;
+ }
+
+ public int size() {
+ return numElements;
+ }
+
+ public String toString() {
+ CharSetEnumerator set = characters();
+
+ StringBuffer result = new StringBuffer("{");
+
+ if ( set.hasMoreElements() ) result.append(""+set.nextElement());
+
+ while ( set.hasMoreElements() ) {
+ int i = set.nextElement();
+ result.append( ", "+i);
+ }
+
+ result.append("}");
+
+ return result.toString();
+ }
+}
Index: /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/src/JFlex/CharSetEnumerator.java
===================================================================
--- /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/src/JFlex/CharSetEnumerator.java (revision 25585)
+++ /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/src/JFlex/CharSetEnumerator.java (revision 25585)
@@ -0,0 +1,88 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * JFlex 1.4.3 *
+ * Copyright (C) 1998-2009 Gerwin Klein *
+ * All rights reserved. *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License. See the file *
+ * COPYRIGHT for more information. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License along *
+ * with this program; if not, write to the Free Software Foundation, Inc., *
+ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *
+ * *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+package JFlex;
+
+
+/**
+ * Enumerator for the elements of a CharSet.
+ *
+ * Does not implement java.util.Enumeration, but supports the same protocol.
+ *
+ * @author Gerwin Klein
+ * @version JFlex 1.4.3, $Revision: 433 $, $Date: 2009-01-31 19:52:34 +1100 (Sat, 31 Jan 2009) $
+ */
+final public class CharSetEnumerator {
+
+ private int index;
+ private int offset;
+ private long mask = 1;
+
+ private CharSet set;
+
+ public CharSetEnumerator(CharSet characters) {
+ set = characters;
+
+ while (index < set.bits.length && set.bits[index] == 0)
+ index++;
+
+ if (index >= set.bits.length) return;
+
+ while (offset <= CharSet.MOD && ((set.bits[index] & mask) == 0)) {
+ mask<<= 1;
+ offset++;
+ }
+ }
+
+ private void advance() {
+ do {
+ offset++;
+ mask<<= 1;
+ } while (offset <= CharSet.MOD && ((set.bits[index] & mask) == 0));
+
+ if (offset > CharSet.MOD) {
+ do
+ index++;
+ while (index < set.bits.length && set.bits[index] == 0);
+
+ if (index >= set.bits.length) return;
+
+ offset = 0;
+ mask = 1;
+
+ while (offset <= CharSet.MOD && ((set.bits[index] & mask) == 0)) {
+ mask<<= 1;
+ offset++;
+ }
+ }
+ }
+
+ public boolean hasMoreElements() {
+ return index < set.bits.length;
+ }
+
+ public int nextElement() {
+ int x = (index << CharSet.BITS) + offset;
+ advance();
+ return x;
+ }
+
+}
+
Index: /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/src/JFlex/CountEmitter.java
===================================================================
--- /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/src/JFlex/CountEmitter.java (revision 25585)
+++ /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/src/JFlex/CountEmitter.java (revision 25585)
@@ -0,0 +1,115 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * jflex 1.4 *
+ * Copyright (C) 1998-2009 Gerwin Klein *
+ * All rights reserved. *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License. See the file *
+ * COPYRIGHT for more information. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License along *
+ * with this program; if not, write to the Free Software Foundation, Inc., *
+ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *
+ * *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+package JFlex;
+
+/**
+ * An emitter for an array encoded as count/value pairs in a string.
+ *
+ * @author Gerwin Klein
+ * @version $Revision: 433 $, $Date: 2009-01-31 19:52:34 +1100 (Sat, 31 Jan 2009) $
+ */
+public class CountEmitter extends PackEmitter {
+ /** number of entries in expanded array */
+ private int numEntries;
+
+ /** translate all values by this amount */
+ private int translate = 0;
+
+
+ /**
+ * Create a count/value emitter for a specific field.
+ *
+ * @param name name of the generated array
+ */
+ protected CountEmitter(String name) {
+ super(name);
+ }
+
+ /**
+ * Emits count/value unpacking code for the generated array.
+ *
+ * @see JFlex.PackEmitter#emitUnPack()
+ */
+ public void emitUnpack() {
+ // close last string chunk:
+ println("\";");
+
+ nl();
+ println(" private static int [] zzUnpack"+name+"() {");
+ println(" int [] result = new int["+numEntries+"];");
+ println(" int offset = 0;");
+
+ for (int i = 0; i < chunks; i++) {
+ println(" offset = zzUnpack"+name+"("+constName()+"_PACKED_"+i+", offset, result);");
+ }
+
+ println(" return result;");
+ println(" }");
+ nl();
+
+ println(" private static int zzUnpack"+name+"(String packed, int offset, int [] result) {");
+ println(" int i = 0; /* index in packed string */");
+ println(" int j = offset; /* index in unpacked array */");
+ println(" int l = packed.length();");
+ println(" while (i < l) {");
+ println(" int count = packed.charAt(i++);");
+ println(" int value = packed.charAt(i++);");
+ if (translate == 1) {
+ println(" value--;");
+ }
+ else if (translate != 0) {
+ println(" value-= "+translate);
+ }
+ println(" do result[j++] = value; while (--count > 0);");
+ println(" }");
+ println(" return j;");
+ println(" }");
+ }
+
+ /**
+ * Translate all values by given amount.
+ *
+ * Use to move value interval from [0, 0xFFFF] to something different.
+ *
+ * @param i amount the value will be translated by.
+ * Example: i = 1
allows values in [-1, 0xFFFE].
+ */
+ public void setValTranslation(int i) {
+ this.translate = i;
+ }
+
+ /**
+ * Emit one count/value pair.
+ *
+ * Automatically translates value by the translate
value.
+ *
+ * @param count
+ * @param value
+ *
+ * @see CountEmitter#setValTranslation(int)
+ */
+ public void emit(int count, int value) {
+ numEntries+= count;
+ breaks();
+ emitUC(count);
+ emitUC(value+translate);
+ }
+}
Index: /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/src/JFlex/DFA.java
===================================================================
--- /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/src/JFlex/DFA.java (revision 25585)
+++ /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/src/JFlex/DFA.java (revision 25585)
@@ -0,0 +1,929 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * JFlex 1.4.3 *
+ * Copyright (C) 1998-2009 Gerwin Klein *
+ * All rights reserved. *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License. See the file *
+ * COPYRIGHT for more information. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License along *
+ * with this program; if not, write to the Free Software Foundation, Inc., *
+ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *
+ * *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+package JFlex;
+
+
+import java.io.*;
+import java.util.*;
+
+
+/**
+ * DFA representation in JFlex.
+ * Contains minimization algorithm.
+ *
+ * @author Gerwin Klein
+ * @version JFlex 1.4.3, $Revision: 433 $, $Date: 2009-01-31 19:52:34 +1100 (Sat, 31 Jan 2009) $
+ */
+final public class DFA {
+
+ /**
+ * The initial number of states
+ */
+ private static final int STATES = 500;
+
+ /**
+ * The code for "no target state" in the transition table.
+ */
+ public static final int NO_TARGET = -1;
+
+ /**
+ * table[current_state][character] is the next state for current_state
+ * with input character
, NO_TARGET
if there is no transition for
+ * this input in current_state
+ */
+ int [][] table;
+
+
+ /**
+ * isFinal[state] == true
<=> the state state
is
+ * a final state.
+ */
+ boolean [] isFinal;
+
+
+ /**
+ * action[state]
is the action that is to be carried out in
+ * state state
, null
if there is no action.
+ */
+ Action [] action;
+
+ /**
+ * entryState[i] is the start-state of lexical state i or
+ * lookahead DFA i
+ */
+ int entryState [];
+
+ /**
+ * The number of states in this DFA
+ */
+ int numStates;
+
+ /**
+ * The current maximum number of input characters
+ */
+ int numInput;
+
+ /**
+ * The number of lexical states (2*numLexStates <= entryState.length)
+ */
+ int numLexStates;
+
+ /**
+ * all actions that are used in this DFA
+ */
+ Hashtable usedActions = new Hashtable();
+
+ /** True iff this DFA contains general lookahead */
+ boolean lookaheadUsed;
+
+ public DFA(int numEntryStates, int numInp, int numLexStates) {
+ numInput = numInp;
+
+ int statesNeeded = Math.max(numEntryStates, STATES);
+
+ table = new int [statesNeeded] [numInput];
+ action = new Action [statesNeeded];
+ isFinal = new boolean [statesNeeded];
+ entryState = new int [numEntryStates];
+ numStates = 0;
+
+ this.numLexStates = numLexStates;
+
+ for (int i = 0; i < statesNeeded; i++) {
+ for (char j = 0; j < numInput; j++)
+ table [i][j] = NO_TARGET;
+ }
+ }
+
+
+ public void setEntryState(int eState, int trueState) {
+ entryState[eState] = trueState;
+ }
+
+ private void ensureStateCapacity(int newNumStates) {
+ int oldLength = isFinal.length;
+
+ if ( newNumStates < oldLength ) return;
+
+ int newLength = oldLength*2;
+ while ( newLength <= newNumStates ) newLength*= 2;
+
+ boolean [] newFinal = new boolean [newLength];
+ boolean [] newPushback = new boolean [newLength];
+ Action [] newAction = new Action [newLength];
+ int [] [] newTable = new int [newLength] [numInput];
+
+ System.arraycopy(isFinal,0,newFinal,0,numStates);
+ System.arraycopy(action,0,newAction,0,numStates);
+ System.arraycopy(table,0,newTable,0,oldLength);
+
+ int i,j;
+
+ for (i = oldLength; i < newLength; i++) {
+ for (j = 0; j < numInput; j++) {
+ newTable[i][j] = NO_TARGET;
+ }
+ }
+
+ isFinal = newFinal;
+ action = newAction;
+ table = newTable;
+ }
+
+
+ public void setAction(int state, Action stateAction) {
+ action[state] = stateAction;
+ if (stateAction != null) {
+ usedActions.put(stateAction,stateAction);
+ lookaheadUsed |= stateAction.isGenLookAction();
+ }
+ }
+
+ public void setFinal(int state, boolean isFinalState) {
+ isFinal[state] = isFinalState;
+ }
+
+ public void addTransition(int start, char input, int dest) {
+ int max = Math.max(start,dest)+1;
+ ensureStateCapacity(max);
+ if (max > numStates) numStates = max;
+
+ // Out.debug("Adding DFA transition ("+start+", "+(int)input+", "+dest+")");
+
+ table[start][input] = dest;
+ }
+
+
+ public String toString() {
+ StringBuffer result = new StringBuffer();
+
+ for (int i=0; i < numStates; i++) {
+ result.append("State ");
+ if ( isFinal[i] ) {
+ result.append("[FINAL");
+ String l = action[i].lookString();
+ if (!l.equals("")) {
+ result.append(", ");
+ result.append(l);
+ }
+ result.append("] ");
+ }
+ result.append(i+":"+Out.NL);
+
+ for (char j=0; j < numInput; j++) {
+ if ( table[i][j] >= 0 )
+ result.append(" with "+(int)j+" in "+table[i][j]+Out.NL);
+ }
+ }
+
+ return result.toString();
+ }
+
+
+ public void writeDot(File file) {
+ try {
+ PrintWriter writer = new PrintWriter(new FileWriter(file));
+ writer.println(dotFormat());
+ writer.close();
+ }
+ catch (IOException e) {
+ Out.error(ErrorMessages.FILE_WRITE, file);
+ throw new GeneratorException();
+ }
+ }
+
+
+ public String dotFormat() {
+ StringBuffer result = new StringBuffer();
+
+ result.append("digraph DFA {"+Out.NL);
+ result.append("rankdir = LR"+Out.NL);
+
+ for (int i=0; i < numStates; i++) {
+ if ( isFinal[i] ) {
+ result.append(i);
+ result.append(" [shape = doublecircle]");
+ result.append(Out.NL);
+ }
+ }
+
+ for (int i=0; i < numStates; i++) {
+ for (int input = 0; input < numInput; input++) {
+ if ( table[i][input] >= 0 ) {
+ result.append(i+" -> "+table[i][input]);
+ result.append(" [label=\"["+input+"]\"]"+Out.NL);
+ // result.append(" [label=\"["+classes.toString(input)+"]\"]\n");
+ }
+ }
+ }
+
+ result.append("}"+Out.NL);
+
+ return result.toString();
+ }
+
+
+ /**
+ * Check that all actions can actually be matched in this DFA.
+ */
+ public void checkActions(LexScan scanner, LexParse parser) {
+ EOFActions eofActions = parser.getEOFActions();
+ Enumeration l = scanner.actions.elements();
+
+ while (l.hasMoreElements()) {
+ Action a = (Action) l.nextElement();
+ if ( !a.equals(usedActions.get(a)) && !eofActions.isEOFAction(a) ) {
+ Out.warning(scanner.file, ErrorMessages.NEVER_MATCH, a.priority-1, -1);
+ }
+ }
+ }
+
+
+ /**
+ * Implementation of Hopcroft's O(n log n) minimization algorithm, follows
+ * description by D. Gries.
+ *
+ * Time: O(n log n)
+ * Space: O(c n), size < 4*(5*c*n + 13*n + 3*c) byte
+ */
+ public void minimize() {
+ Out.print(numStates+" states before minimization, ");
+
+ if (numStates == 0) {
+ Out.error(ErrorMessages.ZERO_STATES);
+ throw new GeneratorException();
+ }
+
+ if (Options.no_minimize) {
+ Out.println("minimization skipped.");
+ return;
+ }
+
+ // the algorithm needs the DFA to be total, so we add an error state 0,
+ // and translate the rest of the states by +1
+ final int n = numStates+1;
+
+ // block information:
+ // [0..n-1] stores which block a state belongs to,
+ // [n..2*n-1] stores how many elements each block has
+ int [] block = new int[2*n];
+
+ // implements a doubly linked list of states (these are the actual blocks)
+ int [] b_forward = new int[2*n];
+ int [] b_backward = new int[2*n];
+
+ // the last of the blocks currently in use (in [n..2*n-1])
+ // (end of list marker, points to the last used block)
+ int lastBlock = n; // at first we start with one empty block
+ final int b0 = n; // the first block
+
+ // the circular doubly linked list L of pairs (B_i, c)
+ // (B_i, c) in L iff l_forward[(B_i-n)*numInput+c] > 0 // numeric value of block 0 = n!
+ int [] l_forward = new int[n*numInput+1];
+ int [] l_backward = new int[n*numInput+1];
+ int anchorL = n*numInput; // list anchor
+
+ // inverse of the transition table
+ // if t = inv_delta[s][c] then { inv_delta_set[t], inv_delta_set[t+1], .. inv_delta_set[k] }
+ // is the set of states, with inv_delta_set[k] = -1 and inv_delta_set[j] >= 0 for t <= j < k
+ int [] [] inv_delta = new int[n][numInput];
+ int [] inv_delta_set = new int [2*n*numInput];
+
+ // twin stores two things:
+ // twin[0]..twin[numSplit-1] is the list of blocks that have been split
+ // twin[B_i] is the twin of block B_i
+ int [] twin = new int[2*n];
+ int numSplit;
+
+ // SD[B_i] is the the number of states s in B_i with delta(s,a) in B_j
+ // if SD[B_i] == block[B_i], there is no need to split
+ int [] SD = new int[2*n]; // [only SD[n..2*n-1] is used]
+
+
+ // for fixed (B_j,a), the D[0]..D[numD-1] are the inv_delta(B_j,a)
+ int [] D = new int[n];
+ int numD;
+
+
+ // initialize inverse of transition table
+ int lastDelta = 0;
+ int [] inv_lists = new int[n]; // holds a set of lists of states
+ int [] inv_list_last = new int[n]; // the last element
+ for (int c = 0; c < numInput; c++) {
+ // clear "head" and "last element" pointers
+ for (int s = 0; s < n; s++) {
+ inv_list_last[s] = -1;
+ inv_delta[s][c] = -1;
+ }
+
+ // the error state has a transition for each character into itself
+ inv_delta[0][c] = 0;
+ inv_list_last[0] = 0;
+
+ // accumulate states of inverse delta into lists (inv_delta serves as head of list)
+ for (int s = 1; s < n; s++) {
+ int t = table[s-1][c]+1;
+
+ if (inv_list_last[t] == -1) { // if there are no elements in the list yet
+ inv_delta[t][c] = s; // mark t as first and last element
+ inv_list_last[t] = s;
+ }
+ else {
+ inv_lists[inv_list_last[t]] = s; // link t into chain
+ inv_list_last[t] = s; // and mark as last element
+ }
+ }
+
+ // now move them to inv_delta_set in sequential order,
+ // and update inv_delta accordingly
+ for (int s = 0; s < n; s++) {
+ int i = inv_delta[s][c]; inv_delta[s][c] = lastDelta;
+ int j = inv_list_last[s];
+ boolean go_on = (i != -1);
+ while (go_on) {
+ go_on = (i != j);
+ inv_delta_set[lastDelta++] = i;
+ i = inv_lists[i];
+ }
+ inv_delta_set[lastDelta++] = -1;
+ }
+ } // of initialize inv_delta
+
+ // printInvDelta(inv_delta, inv_delta_set);
+
+ // initialize blocks
+
+ // make b0 = {0} where 0 = the additional error state
+ b_forward[b0] = 0;
+ b_backward[b0] = 0;
+ b_forward[0] = b0;
+ b_backward[0] = b0;
+ block[0] = b0;
+ block[b0] = 1;
+
+ for (int s = 1; s < n; s++) {
+ // System.out.println("Checking state ["+(s-1)+"]");
+ // search the blocks if it fits in somewhere
+ // (fit in = same pushback behavior, same finalness, same lookahead behavior, same action)
+ int b = b0+1; // no state can be equivalent to the error state
+ boolean found = false;
+ while (!found && b <= lastBlock) {
+ // get some state out of the current block
+ int t = b_forward[b];
+ // System.out.println(" picking state ["+(t-1)+"]");
+
+ // check, if s could be equivalent with t
+ if (isFinal[s-1]) {
+ found = isFinal[t-1] && action[s-1].isEquiv(action[t-1]);
+ }
+ else {
+ found = !isFinal[t-1];
+ }
+
+ if (found) { // found -> add state s to block b
+ // System.out.println("Found! Adding to block "+(b-b0));
+ // update block information
+ block[s] = b;
+ block[b]++;
+
+ // chain in the new element
+ int last = b_backward[b];
+ b_forward[last] = s;
+ b_forward[s] = b;
+ b_backward[b] = s;
+ b_backward[s] = last;
+ }
+
+ b++;
+ }
+
+ if (!found) { // fits in nowhere -> create new block
+ // System.out.println("not found, lastBlock = "+lastBlock);
+
+ // update block information
+ block[s] = b;
+ block[b]++;
+
+ // chain in the new element
+ b_forward[b] = s;
+ b_forward[s] = b;
+ b_backward[b] = s;
+ b_backward[s] = b;
+
+ lastBlock++;
+ }
+ } // of initialize blocks
+
+ // printBlocks(block,b_forward,b_backward,lastBlock);
+
+ // initialize worklist L
+ // first, find the largest block B_max, then, all other (B_i,c) go into the list
+ int B_max = b0;
+ int B_i;
+ for (B_i = b0+1; B_i <= lastBlock; B_i++)
+ if (block[B_max] < block[B_i]) B_max = B_i;
+
+ // L = empty
+ l_forward[anchorL] = anchorL;
+ l_backward[anchorL] = anchorL;
+
+ // set up the first list element
+ if (B_max == b0) B_i = b0+1; else B_i = b0; // there must be at least two blocks
+
+ int index = (B_i-b0)*numInput; // (B_i, 0)
+ while (index < (B_i+1-b0)*numInput) {
+ int last = l_backward[anchorL];
+ l_forward[last] = index;
+ l_forward[index] = anchorL;
+ l_backward[index] = last;
+ l_backward[anchorL] = index;
+ index++;
+ }
+
+ // now do the rest of L
+ while (B_i <= lastBlock) {
+ if (B_i != B_max) {
+ index = (B_i-b0)*numInput;
+ while (index < (B_i+1-b0)*numInput) {
+ int last = l_backward[anchorL];
+ l_forward[last] = index;
+ l_forward[index] = anchorL;
+ l_backward[index] = last;
+ l_backward[anchorL] = index;
+ index++;
+ }
+ }
+ B_i++;
+ }
+ // end of setup L
+
+ // start of "real" algorithm
+ // int step = 0;
+ // System.out.println("max_steps = "+(n*numInput));
+ // while L not empty
+ while (l_forward[anchorL] != anchorL) {
+ // System.out.println("step : "+(step++));
+ // printL(l_forward, l_backward, anchorL);
+
+ // pick and delete (B_j, a) in L:
+
+ // pick
+ int B_j_a = l_forward[anchorL];
+ // delete
+ l_forward[anchorL] = l_forward[B_j_a];
+ l_backward[l_forward[anchorL]] = anchorL;
+ l_forward[B_j_a] = 0;
+ // take B_j_a = (B_j-b0)*numInput+c apart into (B_j, a)
+ int B_j = b0 + B_j_a / numInput;
+ int a = B_j_a % numInput;
+
+ // printL(l_forward, l_backward, anchorL);
+
+ // System.out.println("picked ("+B_j+","+a+")");
+ // printL(l_forward, l_backward, anchorL);
+
+ // determine splittings of all blocks wrt (B_j, a)
+ // i.e. D = inv_delta(B_j,a)
+ numD = 0;
+ int s = b_forward[B_j];
+ while (s != B_j) {
+ // System.out.println("splitting wrt. state "+s);
+ int t = inv_delta[s][a];
+ // System.out.println("inv_delta chunk "+t);
+ while (inv_delta_set[t] != -1) {
+ // System.out.println("D+= state "+inv_delta_set[t]);
+ D[numD++] = inv_delta_set[t++];
+ }
+ s = b_forward[s];
+ }
+
+ // clear the twin list
+ numSplit = 0;
+
+ // System.out.println("splitting blocks according to D");
+
+ // clear SD and twins (only those B_i that occur in D)
+ for (int indexD = 0; indexD < numD; indexD++) { // for each s in D
+ s = D[indexD];
+ B_i = block[s];
+ SD[B_i] = -1;
+ twin[B_i] = 0;
+ }
+
+ // count how many states of each B_i occurring in D go with a into B_j
+ // Actually we only check, if *all* t in B_i go with a into B_j.
+ // In this case SD[B_i] == block[B_i] will hold.
+ for (int indexD = 0; indexD < numD; indexD++) { // for each s in D
+ s = D[indexD];
+ B_i = block[s];
+
+ // only count, if we haven't checked this block already
+ if (SD[B_i] < 0) {
+ SD[B_i] = 0;
+ int t = b_forward[B_i];
+ while (t != B_i && (t != 0 || block[0] == B_j) &&
+ (t == 0 || block[table[t-1][a]+1] == B_j)) {
+ SD[B_i]++;
+ t = b_forward[t];
+ }
+ }
+ }
+
+ // split each block according to D
+ for (int indexD = 0; indexD < numD; indexD++) { // for each s in D
+ s = D[indexD];
+ B_i = block[s];
+
+ // System.out.println("checking if block "+(B_i-b0)+" must be split because of state "+s);
+
+ if (SD[B_i] != block[B_i]) {
+ // System.out.println("state "+(s-1)+" must be moved");
+ int B_k = twin[B_i];
+ if (B_k == 0) {
+ // no twin for B_i yet -> generate new block B_k, make it B_i's twin
+ B_k = ++lastBlock;
+ // System.out.println("creating block "+(B_k-n));
+ // printBlocks(block,b_forward,b_backward,lastBlock-1);
+ b_forward[B_k] = B_k;
+ b_backward[B_k] = B_k;
+
+ twin[B_i] = B_k;
+
+ // mark B_i as split
+ twin[numSplit++] = B_i;
+ }
+ // move s from B_i to B_k
+
+ // remove s from B_i
+ b_forward[b_backward[s]] = b_forward[s];
+ b_backward[b_forward[s]] = b_backward[s];
+
+ // add s to B_k
+ int last = b_backward[B_k];
+ b_forward[last] = s;
+ b_forward[s] = B_k;
+ b_backward[s] = last;
+ b_backward[B_k] = s;
+
+ block[s] = B_k;
+ block[B_k]++;
+ block[B_i]--;
+
+ SD[B_i]--; // there is now one state less in B_i that goes with a into B_j
+ // printBlocks(block, b_forward, b_backward, lastBlock);
+ // System.out.println("finished move");
+ }
+ } // of block splitting
+
+ // printBlocks(block, b_forward, b_backward, lastBlock);
+
+ // System.out.println("updating L");
+
+ // update L
+ for (int indexTwin = 0; indexTwin < numSplit; indexTwin++) {
+ B_i = twin[indexTwin];
+ int B_k = twin[B_i];
+ for (int c = 0; c < numInput; c++) {
+ int B_i_c = (B_i-b0)*numInput+c;
+ int B_k_c = (B_k-b0)*numInput+c;
+ if (l_forward[B_i_c] > 0) {
+ // (B_i,c) already in L --> put (B_k,c) in L
+ int last = l_backward[anchorL];
+ l_backward[anchorL] = B_k_c;
+ l_forward[last] = B_k_c;
+ l_backward[B_k_c] = last;
+ l_forward[B_k_c] = anchorL;
+ }
+ else {
+ // put the smaller block in L
+ if (block[B_i] <= block[B_k]) {
+ int last = l_backward[anchorL];
+ l_backward[anchorL] = B_i_c;
+ l_forward[last] = B_i_c;
+ l_backward[B_i_c] = last;
+ l_forward[B_i_c] = anchorL;
+ }
+ else {
+ int last = l_backward[anchorL];
+ l_backward[anchorL] = B_k_c;
+ l_forward[last] = B_k_c;
+ l_backward[B_k_c] = last;
+ l_forward[B_k_c] = anchorL;
+ }
+ }
+ }
+ }
+ }
+
+ // System.out.println("Result");
+ // printBlocks(block,b_forward,b_backward,lastBlock);
+
+ /*
+ System.out.println("Old minimization:");
+ boolean [] [] equiv = old_minimize();
+
+ boolean error = false;
+ for (int i = 1; i < equiv.length; i++) {
+ for (int j = 0; j < equiv[i].length; j++) {
+ if (equiv[i][j] != (block[i+1] == block[j+1])) {
+ System.out.println("error: equiv["+i+"]["+j+"] = "+equiv[i][j]+
+ ", block["+i+"] = "+block[i+1]+", block["+j+"] = "+block[j]);
+ error = true;
+ }
+ }
+ }
+
+ if (error) System.exit(1);
+ System.out.println("check");
+ */
+
+ // transform the transition table
+
+ // trans[i] is the state j that will replace state i, i.e.
+ // states i and j are equivalent
+ int trans [] = new int [numStates];
+
+ // kill[i] is true iff state i is redundant and can be removed
+ boolean kill [] = new boolean [numStates];
+
+ // move[i] is the amount line i has to be moved in the transition table
+ // (because states j < i have been removed)
+ int move [] = new int [numStates];
+
+ // fill arrays trans[] and kill[] (in O(n))
+ for (int b = b0+1; b <= lastBlock; b++) { // b0 contains the error state
+ // get the state with smallest value in current block
+ int s = b_forward[b];
+ int min_s = s; // there are no empty blocks!
+ for (; s != b; s = b_forward[s])
+ if (min_s > s) min_s = s;
+ // now fill trans[] and kill[] for this block
+ // (and translate states back to partial DFA)
+ min_s--;
+ for (s = b_forward[b]-1; s != b-1; s = b_forward[s+1]-1) {
+ trans[s] = min_s;
+ kill[s] = s != min_s;
+ }
+ }
+
+ // fill array move[] (in O(n))
+ int amount = 0;
+ for (int i = 0; i < numStates; i++) {
+ if ( kill[i] )
+ amount++;
+ else
+ move[i] = amount;
+ }
+
+ int i,j;
+ // j is the index in the new transition table
+ // the transition table is transformed in place (in O(c n))
+ for (i = 0, j = 0; i < numStates; i++) {
+
+ // we only copy lines that have not been removed
+ if ( !kill[i] ) {
+
+ // translate the target states
+ for (int c = 0; c < numInput; c++) {
+ if ( table[i][c] >= 0 ) {
+ table[j][c] = trans[ table[i][c] ];
+ table[j][c]-= move[ table[j][c] ];
+ }
+ else {
+ table[j][c] = table[i][c];
+ }
+ }
+
+ isFinal[j] = isFinal[i];
+ action[j] = action[i];
+
+ j++;
+ }
+ }
+
+ numStates = j;
+
+ // translate lexical states
+ for (i = 0; i < entryState.length; i++) {
+ entryState[i] = trans[ entryState[i] ];
+ entryState[i]-= move[ entryState[i] ];
+ }
+
+ Out.println(numStates+" states in minimized DFA");
+ }
+
+ public String toString(int [] a) {
+ String r = "{";
+ int i;
+ for (i = 0; i < a.length-1; i++) r += a[i]+",";
+ return r+a[i]+"}";
+ }
+
+ public void printBlocks(int [] b, int [] b_f, int [] b_b, int last) {
+ Out.dump("block : "+toString(b));
+ Out.dump("b_forward : "+toString(b_f));
+ Out.dump("b_backward: "+toString(b_b));
+ Out.dump("lastBlock : "+last);
+ final int n = numStates+1;
+ for (int i = n; i <= last; i ++) {
+ Out.dump("Block "+(i-n)+" (size "+b[i]+"):");
+ String line = "{";
+ int s = b_f[i];
+ while (s != i) {
+ line = line+(s-1);
+ int t = s;
+ s = b_f[s];
+ if (s != i) {
+ line = line+",";
+ if (b[s] != i) Out.dump("consistency error for state "+(s-1)+" (block "+b[s]+")");
+ }
+ if (b_b[s] != t) Out.dump("consistency error for b_back in state "+(s-1)+" (back = "+b_b[s]+", should be = "+t+")");
+ }
+ Out.dump(line+"}");
+ }
+ }
+
+ public void printL(int [] l_f, int [] l_b, int anchor) {
+ String l = "L = {";
+ int bc = l_f[anchor];
+ while (bc != anchor) {
+ int b = bc / numInput;
+ int c = bc % numInput;
+ l+= "("+b+","+c+")";
+ int old_bc = bc;
+ bc = l_f[bc];
+ if (bc != anchor) l+= ",";
+ if (l_b[bc] != old_bc) Out.dump("consistency error for ("+b+","+c+")");
+ }
+ Out.dump(l+"}");
+ }
+
+
+ /**
+ * Much simpler, but slower and less memory efficient minimization algorithm.
+ *
+ * @return the equivalence relation on states.
+ */
+ public boolean [] [] old_minimize() {
+
+ int i,j;
+ char c;
+
+ Out.print(numStates+" states before minimization, ");
+
+ if (numStates == 0) {
+ Out.error(ErrorMessages.ZERO_STATES);
+ throw new GeneratorException();
+ }
+
+ if (Options.no_minimize) {
+ Out.println("minimization skipped.");
+ return null;
+ }
+
+ // equiv[i][j] == true <=> state i and state j are equivalent
+ boolean [] [] equiv = new boolean [numStates] [];
+
+ // list[i][j] contains all pairs of states that have to be marked "not equivalent"
+ // if states i and j are recognized to be not equivalent
+ StatePairList [] [] list = new StatePairList [numStates] [];
+
+ // construct a triangular matrix equiv[i][j] with j < i
+ // and mark pairs (final state, not final state) as not equivalent
+ for (i = 1; i < numStates; i++) {
+ list[i] = new StatePairList[i];
+ equiv[i] = new boolean [i];
+ for (j = 0; j < i; j++) {
+ // i and j are equivalent, iff :
+ // i and j are both final and their actions are equivalent and have same pushback behaviour or
+ // i and j are both not final
+
+ if ( isFinal[i] && isFinal[j] )
+ equiv[i][j] = action[i].isEquiv(action[j]);
+ else
+ equiv[i][j] = !isFinal[j] && !isFinal[i];
+ }
+ }
+
+
+ for (i = 1; i < numStates; i++) {
+
+ Out.debug("Testing state "+i);
+
+ for (j = 0; j < i; j++) {
+
+ if ( equiv[i][j] ) {
+
+ for (c = 0; c < numInput; c++) {
+
+ if (equiv[i][j]) {
+
+ int p = table[i][c];
+ int q = table[j][c];
+ if (p < q) {
+ int t = p;
+ p = q;
+ q = t;
+ }
+ if ( p >= 0 || q >= 0 ) {
+ // Out.debug("Testing input '"+c+"' for ("+i+","+j+")");
+ // Out.debug("Target states are ("+p+","+q+")");
+ if ( p!=q && (p == -1 || q == -1 || !equiv[p][q]) ) {
+ equiv[i][j] = false;
+ if (list[i][j] != null) list[i][j].markAll(list,equiv);
+ }
+ // printTable(equiv);
+ } // if (p >= 0) ..
+ } // if (equiv[i][j]
+ } // for (char c = 0; c < numInput ..
+
+ // if i and j are still marked equivalent..
+
+ if ( equiv[i][j] ) {
+
+ // Out.debug("("+i+","+j+") are still marked equivalent");
+
+ for (c = 0; c < numInput; c++) {
+
+ int p = table[i][c];
+ int q = table[j][c];
+ if (p < q) {
+ int t = p;
+ p = q;
+ q = t;
+ }
+
+ if (p != q && p >= 0 && q >= 0) {
+ if ( list[p][q] == null ) {
+ list[p][q] = new StatePairList();
+ }
+ list[p][q].addPair(i,j);
+ }
+ }
+ }
+ else {
+ // Out.debug("("+i+","+j+") are not equivalent");
+ }
+
+ } // of first if (equiv[i][j])
+ } // of for j
+ } // of for i
+ // }
+
+ // printTable(equiv);
+
+ return equiv;
+ }
+
+
+ public void printInvDelta(int [] [] inv_delta, int [] inv_delta_set) {
+ Out.dump("Inverse of transition table: ");
+ for (int s = 0; s < numStates+1; s++) {
+ Out.dump("State ["+(s-1)+"]");
+ for (int c = 0; c < numInput; c++) {
+ String line = "With <"+c+"> in {";
+ int t = inv_delta[s][c];
+ while (inv_delta_set[t] != -1) {
+ line += inv_delta_set[t++]-1;
+ if (inv_delta_set[t] != -1) line += ",";
+ }
+ if (inv_delta_set[inv_delta[s][c]] != -1)
+ Out.dump(line+"}");
+ }
+ }
+ }
+
+ public void printTable(boolean [] [] equiv) {
+
+ Out.dump("Equivalence table is : ");
+ for (int i = 1; i < numStates; i++) {
+ String line = i+" :";
+ for (int j = 0; j < i; j++) {
+ if (equiv[i][j])
+ line+= " E";
+ else
+ line+= " x";
+ }
+ Out.dump(line);
+ }
+ }
+
+}
Index: /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/src/JFlex/EOFActions.java
===================================================================
--- /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/src/JFlex/EOFActions.java (revision 25585)
+++ /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/src/JFlex/EOFActions.java (revision 25585)
@@ -0,0 +1,94 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * JFlex 1.4.3 *
+ * Copyright (C) 1998-2009 Gerwin Klein *
+ * All rights reserved. *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License. See the file *
+ * COPYRIGHT for more information. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License along *
+ * with this program; if not, write to the Free Software Foundation, Inc., *
+ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *
+ * *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+package JFlex;
+
+import java.util.*;
+
+
+/**
+ * A simple table to store EOF actions for each lexical state.
+ *
+ * @author Gerwin Klein
+ * @version JFlex 1.4.3, $Revision: 433 $, $Date: 2009-01-31 19:52:34 +1100 (Sat, 31 Jan 2009) $
+ */
+public class EOFActions {
+
+ /** maps lexical states to actions */
+ private Hashtable /* Integer -> Action */ actions = new Hashtable();
+ private Action defaultAction;
+ private int numLexStates;
+
+ public void setNumLexStates(int num) {
+ numLexStates = num;
+ }
+
+ public void add(Vector stateList, Action action) {
+
+ if (stateList != null && stateList.size() > 0) {
+ Enumeration states = stateList.elements();
+
+ while (states.hasMoreElements())
+ add( (Integer) states.nextElement(), action );
+ }
+ else {
+ defaultAction = action.getHigherPriority(defaultAction);
+
+ for (int i = 0; i < numLexStates; i++) {
+ Integer state = new Integer(i);
+ if ( actions.get(state) != null ) {
+ Action oldAction = (Action) actions.get(state);
+ actions.put(state, oldAction.getHigherPriority(action));
+ }
+ }
+ }
+ }
+
+ public void add(Integer state, Action action) {
+ if ( actions.get(state) == null )
+ actions.put(state, action);
+ else {
+ Action oldAction = (Action) actions.get(state);
+ actions.put(state, oldAction.getHigherPriority(action));
+ }
+ }
+
+ public boolean isEOFAction(Object a) {
+ if (a == defaultAction) return true;
+
+ Enumeration e = actions.elements();
+ while ( e.hasMoreElements() )
+ if (a == e.nextElement()) return true;
+
+ return false;
+ }
+
+ public Action getAction(int state) {
+ return (Action) actions.get(new Integer(state));
+ }
+
+ public Action getDefault() {
+ return defaultAction;
+ }
+
+ public int numActions() {
+ return actions.size();
+ }
+}
Index: /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/src/JFlex/Emitter.java
===================================================================
--- /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/src/JFlex/Emitter.java (revision 25585)
+++ /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/src/JFlex/Emitter.java (revision 25585)
@@ -0,0 +1,1633 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * JFlex 1.4.3 *
+ * Copyright (C) 1998-2009 Gerwin Klein *
+ * All rights reserved. *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License. See the file *
+ * COPYRIGHT for more information. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License along *
+ * with this program; if not, write to the Free Software Foundation, Inc., *
+ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *
+ * *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+package JFlex;
+
+import java.io.*;
+import java.util.*;
+import java.text.*;
+
+/**
+ * This class manages the actual code generation, putting
+ * the scanner together, filling in skeleton sections etc.
+ *
+ * Table compression, String packing etc. is also done here.
+ *
+ * @author Gerwin Klein
+ * @version JFlex 1.4.3, $Revision: 433 $, $Date: 2009-01-31 19:52:34 +1100 (Sat, 31 Jan 2009) $
+ */
+final public class Emitter {
+
+ // bit masks for state attributes
+ static final private int FINAL = 1;
+ static final private int NOLOOK = 8;
+
+ static final private String date = (new SimpleDateFormat()).format(new Date());
+
+ private File inputFile;
+
+ private PrintWriter out;
+ private Skeleton skel;
+ private LexScan scanner;
+ private LexParse parser;
+ private DFA dfa;
+
+ // for switch statement:
+ // table[i][j] is the set of input characters that leads from state i to state j
+ private CharSet table[][];
+
+ private boolean isTransition[];
+
+ // noTarget[i] is the set of input characters that have no target state in state i
+ private CharSet noTarget[];
+
+ // for row killing:
+ private int numRows;
+ private int [] rowMap;
+ private boolean [] rowKilled;
+
+ // for col killing:
+ private int numCols;
+ private int [] colMap;
+ private boolean [] colKilled;
+
+
+ /** maps actions to their switch label */
+ private Hashtable actionTable = new Hashtable();
+
+ private CharClassInterval [] intervals;
+
+ private String visibility = "public";
+
+ public Emitter(File inputFile, LexParse parser, DFA dfa) throws IOException {
+
+ String name = getBaseName(parser.scanner.className) + ".java";
+
+ File outputFile = normalize(name, inputFile);
+
+ Out.println("Writing code to \""+outputFile+"\"");
+
+ this.out = new PrintWriter(new BufferedWriter(new FileWriter(outputFile)));
+ this.parser = parser;
+ this.scanner = parser.scanner;
+ this.visibility = scanner.visibility;
+ this.inputFile = inputFile;
+ this.dfa = dfa;
+ this.skel = new Skeleton(out);
+ }
+
+ /**
+ * Computes base name of the class name. Needs to take into account generics.
+ *
+ * @see LexScan#className
+ * @return the
+ */
+ public static String getBaseName(String className) {
+ int gen = className.indexOf('<');
+ if (gen < 0) {
+ return className;
+ }
+ else {
+ return className.substring(0, gen);
+ }
+ }
+
+
+ /**
+ * Constructs a file in Options.getDir() or in the same directory as
+ * another file. Makes a backup if the file already exists.
+ *
+ * @param name the name (without path) of the file
+ * @param path the path where to construct the file
+ * @param input fall back location if path = null
+ * (expected to be a file in the directory to write to)
+ */
+ public static File normalize(String name, File input) {
+ File outputFile;
+
+ if ( Options.getDir() == null )
+ if ( input == null || input.getParent() == null )
+ outputFile = new File(name);
+ else
+ outputFile = new File(input.getParent(), name);
+ else
+ outputFile = new File(Options.getDir(), name);
+
+ if ( outputFile.exists() && !Options.no_backup ) {
+ File backup = new File( outputFile.toString()+"~" );
+
+ if ( backup.exists() ) backup.delete();
+
+ if ( outputFile.renameTo( backup ) )
+ Out.println("Old file \""+outputFile+"\" saved as \""+backup+"\"");
+ else
+ Out.println("Couldn't save old file \""+outputFile+"\", overwriting!");
+ }
+
+ return outputFile;
+ }
+
+ private void println() {
+ out.println();
+ }
+
+ private void println(String line) {
+ out.println(line);
+ }
+
+ private void println(int i) {
+ out.println(i);
+ }
+
+ private void print(String line) {
+ out.print(line);
+ }
+
+ private void print(int i) {
+ out.print(i);
+ }
+
+ private void print(int i, int tab) {
+ int exp;
+
+ if (i < 0)
+ exp = 1;
+ else
+ exp = 10;
+
+ while (tab-- > 1) {
+ if (Math.abs(i) < exp) print(" ");
+ exp*= 10;
+ }
+
+ print(i);
+ }
+
+ private boolean hasGenLookAhead() {
+ return dfa.lookaheadUsed;
+ }
+
+ private void emitLookBuffer() {
+ if (!hasGenLookAhead()) return;
+
+ println(" /** For the backwards DFA of general lookahead statements */");
+ println(" private boolean [] zzFin = new boolean [ZZ_BUFFERSIZE+1];");
+ println();
+ }
+
+ private void emitScanError() {
+ print(" private void zzScanError(int errorCode)");
+
+ if (scanner.scanErrorException != null)
+ print(" throws "+scanner.scanErrorException);
+
+ println(" {");
+
+ skel.emitNext();
+
+ if (scanner.scanErrorException == null)
+ println(" throw new Error(message);");
+ else
+ println(" throw new "+scanner.scanErrorException+"(message);");
+
+ skel.emitNext();
+
+ print(" "+visibility+" void yypushback(int number) ");
+
+ if (scanner.scanErrorException == null)
+ println(" {");
+ else
+ println(" throws "+scanner.scanErrorException+" {");
+ }
+
+ private void emitMain() {
+ if ( !(scanner.standalone || scanner.debugOption || scanner.cupDebug) ) return;
+
+ if ( scanner.cupDebug ) {
+ println(" /**");
+ println(" * Converts an int token code into the name of the");
+ println(" * token by reflection on the cup symbol class/interface "+scanner.cupSymbol);
+ println(" *");
+ println(" * This code was contributed by Karl Meissner ");
+ println(" */");
+ println(" private String getTokenName(int token) {");
+ println(" try {");
+ println(" java.lang.reflect.Field [] classFields = " + scanner.cupSymbol + ".class.getFields();");
+ println(" for (int i = 0; i < classFields.length; i++) {");
+ println(" if (classFields[i].getInt(null) == token) {");
+ println(" return classFields[i].getName();");
+ println(" }");
+ println(" }");
+ println(" } catch (Exception e) {");
+ println(" e.printStackTrace(System.err);");
+ println(" }");
+ println("");
+ println(" return \"UNKNOWN TOKEN\";");
+ println(" }");
+ println("");
+ println(" /**");
+ println(" * Same as "+scanner.functionName+" but also prints the token to standard out");
+ println(" * for debugging.");
+ println(" *");
+ println(" * This code was contributed by Karl Meissner ");
+ println(" */");
+
+ print(" "+visibility+" ");
+ if ( scanner.tokenType == null ) {
+ if ( scanner.isInteger )
+ print( "int" );
+ else
+ if ( scanner.isIntWrap )
+ print( "Integer" );
+ else
+ print( "Yytoken" );
+ }
+ else
+ print( scanner.tokenType );
+
+ print(" debug_");
+
+ print(scanner.functionName);
+
+ print("() throws java.io.IOException");
+
+ if ( scanner.lexThrow != null ) {
+ print(", ");
+ print(scanner.lexThrow);
+ }
+
+ if ( scanner.scanErrorException != null ) {
+ print(", ");
+ print(scanner.scanErrorException);
+ }
+
+ println(" {");
+
+ println(" java_cup.runtime.Symbol s = "+scanner.functionName+"();");
+ print(" System.out.println( ");
+ if (scanner.lineCount) print("\"line:\" + (yyline+1) + ");
+ if (scanner.columnCount) print("\" col:\" + (yycolumn+1) + ");
+ println("\" --\"+ yytext() + \"--\" + getTokenName(s.sym) + \"--\");");
+ println(" return s;");
+ println(" }");
+ println("");
+ }
+
+ if ( scanner.standalone ) {
+ println(" /**");
+ println(" * Runs the scanner on input files.");
+ println(" *");
+ println(" * This is a standalone scanner, it will print any unmatched");
+ println(" * text to System.out unchanged.");
+ println(" *");
+ println(" * @param argv the command line, contains the filenames to run");
+ println(" * the scanner on.");
+ println(" */");
+ }
+ else {
+ println(" /**");
+ println(" * Runs the scanner on input files.");
+ println(" *");
+ println(" * This main method is the debugging routine for the scanner.");
+ println(" * It prints debugging information about each returned token to");
+ println(" * System.out until the end of file is reached, or an error occured.");
+ println(" *");
+ println(" * @param argv the command line, contains the filenames to run");
+ println(" * the scanner on.");
+ println(" */");
+ }
+
+ String className = getBaseName(scanner.className);
+
+ println(" public static void main(String argv[]) {");
+ println(" if (argv.length == 0) {");
+ println(" System.out.println(\"Usage : java "+className+" \");");
+ println(" }");
+ println(" else {");
+ println(" for (int i = 0; i < argv.length; i++) {");
+ println(" "+className+" scanner = null;");
+ println(" try {");
+ println(" scanner = new "+className+"( new java.io.FileReader(argv[i]) );");
+
+ if ( scanner.standalone ) {
+ println(" while ( !scanner.zzAtEOF ) scanner."+scanner.functionName+"();");
+ }
+ else if (scanner.cupDebug ) {
+ println(" while ( !scanner.zzAtEOF ) scanner.debug_"+scanner.functionName+"();");
+ }
+ else {
+ println(" do {");
+ println(" System.out.println(scanner."+scanner.functionName+"());");
+ println(" } while (!scanner.zzAtEOF);");
+ println("");
+ }
+
+ println(" }");
+ println(" catch (java.io.FileNotFoundException e) {");
+ println(" System.out.println(\"File not found : \\\"\"+argv[i]+\"\\\"\");");
+ println(" }");
+ println(" catch (java.io.IOException e) {");
+ println(" System.out.println(\"IO error scanning file \\\"\"+argv[i]+\"\\\"\");");
+ println(" System.out.println(e);");
+ println(" }");
+ println(" catch (Exception e) {");
+ println(" System.out.println(\"Unexpected exception:\");");
+ println(" e.printStackTrace();");
+ println(" }");
+ println(" }");
+ println(" }");
+ println(" }");
+ println("");
+ }
+
+ private void emitNoMatch() {
+ println(" zzScanError(ZZ_NO_MATCH);");
+ }
+
+ private void emitNextInput() {
+ println(" if (zzCurrentPosL < zzEndReadL)");
+ println(" zzInput = zzBufferL[zzCurrentPosL++];");
+ println(" else if (zzAtEOF) {");
+ println(" zzInput = YYEOF;");
+ println(" break zzForAction;");
+ println(" }");
+ println(" else {");
+ println(" // store back cached positions");
+ println(" zzCurrentPos = zzCurrentPosL;");
+ println(" zzMarkedPos = zzMarkedPosL;");
+ println(" boolean eof = zzRefill();");
+ println(" // get translated positions and possibly new buffer");
+ println(" zzCurrentPosL = zzCurrentPos;");
+ println(" zzMarkedPosL = zzMarkedPos;");
+ println(" zzBufferL = zzBuffer;");
+ println(" zzEndReadL = zzEndRead;");
+ println(" if (eof) {");
+ println(" zzInput = YYEOF;");
+ println(" break zzForAction;");
+ println(" }");
+ println(" else {");
+ println(" zzInput = zzBufferL[zzCurrentPosL++];");
+ println(" }");
+ println(" }");
+ }
+
+ private void emitHeader() {
+ println("/* The following code was generated by JFlex "+Main.version+" on "+date+" */");
+ println("");
+ }
+
+ private void emitUserCode() {
+ if ( scanner.userCode.length() > 0 )
+ println(scanner.userCode.toString());
+ }
+
+ private void emitClassName() {
+ if (!endsWithJavadoc(scanner.userCode)) {
+ String path = inputFile.toString();
+ // slashify path (avoid backslash u sequence = unicode escape)
+ if (File.separatorChar != '/') {
+ path = path.replace(File.separatorChar, '/');
+ }
+
+ println("/**");
+ println(" * This class is a scanner generated by ");
+ println(" * JFlex "+Main.version);
+ println(" * on "+date+" from the specification file");
+ println(" * "+path+"");
+ println(" */");
+ }
+
+ if ( scanner.isPublic ) print("public ");
+
+ if ( scanner.isAbstract) print("abstract ");
+
+ if ( scanner.isFinal ) print("final ");
+
+ print("class ");
+ print(scanner.className);
+
+ if ( scanner.isExtending != null ) {
+ print(" extends ");
+ print(scanner.isExtending);
+ }
+
+ if ( scanner.isImplementing != null ) {
+ print(" implements ");
+ print(scanner.isImplementing);
+ }
+
+ println(" {");
+ }
+
+ /**
+ * Try to find out if user code ends with a javadoc comment
+ *
+ * @param buffer the user code
+ * @return true if it ends with a javadoc comment
+ */
+ public static boolean endsWithJavadoc(StringBuffer usercode) {
+ String s = usercode.toString().trim();
+
+ if (!s.endsWith("*/")) return false;
+
+ // find beginning of javadoc comment
+ int i = s.lastIndexOf("/**");
+ if (i < 0) return false;
+
+ // javadoc comment shouldn't contain a comment end
+ return s.substring(i,s.length()-2).indexOf("*/") < 0;
+ }
+
+
+ private void emitLexicalStates() {
+ Enumeration stateNames = scanner.states.names();
+
+ while ( stateNames.hasMoreElements() ) {
+ String name = (String) stateNames.nextElement();
+
+ int num = scanner.states.getNumber(name).intValue();
+
+ println(" "+visibility+" static final int "+name+" = "+2*num+";");
+ }
+
+ // can't quite get rid of the indirection, even for non-bol lex states:
+ // their DFA states might be the same, but their EOF actions might be different
+ // (see bug #1540228)
+ println("");
+ println(" /**");
+ println(" * ZZ_LEXSTATE[l] is the state in the DFA for the lexical state l");
+ println(" * ZZ_LEXSTATE[l+1] is the state in the DFA for the lexical state l");
+ println(" * at the beginning of a line");
+ println(" * l is of the form l = 2*k, k a non negative integer");
+ println(" */");
+ println(" private static final int ZZ_LEXSTATE[] = { ");
+
+ int i, j = 0;
+ print(" ");
+
+ for (i = 0; i < 2*dfa.numLexStates-1; i++) {
+ print( dfa.entryState[i], 2 );
+
+ print(", ");
+
+ if (++j >= 16) {
+ println();
+ print(" ");
+ j = 0;
+ }
+ }
+
+ println( dfa.entryState[i] );
+ println(" };");
+ }
+
+ private void emitDynamicInit() {
+ int count = 0;
+ int value = dfa.table[0][0];
+
+ println(" /** ");
+ println(" * The transition table of the DFA");
+ println(" */");
+
+ CountEmitter e = new CountEmitter("Trans");
+ e.setValTranslation(+1); // allow vals in [-1, 0xFFFE]
+ e.emitInit();
+
+ for (int i = 0; i < dfa.numStates; i++) {
+ if ( !rowKilled[i] ) {
+ for (int c = 0; c < dfa.numInput; c++) {
+ if ( !colKilled[c] ) {
+ if (dfa.table[i][c] == value) {
+ count++;
+ }
+ else {
+ e.emit(count, value);
+
+ count = 1;
+ value = dfa.table[i][c];
+ }
+ }
+ }
+ }
+ }
+
+ e.emit(count, value);
+ e.emitUnpack();
+
+ println(e.toString());
+ }
+
+
+ private void emitCharMapInitFunction() {
+
+ CharClasses cl = parser.getCharClasses();
+
+ if ( cl.getMaxCharCode() < 256 ) return;
+
+ println("");
+ println(" /** ");
+ println(" * Unpacks the compressed character translation table.");
+ println(" *");
+ println(" * @param packed the packed character translation table");
+ println(" * @return the unpacked character translation table");
+ println(" */");
+ println(" private static char [] zzUnpackCMap(String packed) {");
+ println(" char [] map = new char[0x10000];");
+ println(" int i = 0; /* index in packed string */");
+ println(" int j = 0; /* index in unpacked array */");
+ println(" while (i < "+2*intervals.length+") {");
+ println(" int count = packed.charAt(i++);");
+ println(" char value = packed.charAt(i++);");
+ println(" do map[j++] = value; while (--count > 0);");
+ println(" }");
+ println(" return map;");
+ println(" }");
+ }
+
+ private void emitZZTrans() {
+
+ int i,c;
+ int n = 0;
+
+ println(" /** ");
+ println(" * The transition table of the DFA");
+ println(" */");
+ println(" private static final int ZZ_TRANS [] = {");
+
+ print(" ");
+ for (i = 0; i < dfa.numStates; i++) {
+
+ if ( !rowKilled[i] ) {
+ for (c = 0; c < dfa.numInput; c++) {
+ if ( !colKilled[c] ) {
+ if (n >= 10) {
+ println();
+ print(" ");
+ n = 0;
+ }
+ print( dfa.table[i][c] );
+ if (i != dfa.numStates-1 || c != dfa.numInput-1)
+ print( ", ");
+ n++;
+ }
+ }
+ }
+ }
+
+ println();
+ println(" };");
+ }
+
+ private void emitCharMapArrayUnPacked() {
+
+ CharClasses cl = parser.getCharClasses();
+
+ println("");
+ println(" /** ");
+ println(" * Translates characters to character classes");
+ println(" */");
+ println(" private static final char [] ZZ_CMAP = {");
+
+ int n = 0; // numbers of entries in current line
+ print(" ");
+
+ int max = cl.getMaxCharCode();
+
+ // not very efficient, but good enough for <= 255 characters
+ for (char c = 0; c <= max; c++) {
+ print(colMap[cl.getClassCode(c)],2);
+
+ if (c < max) {
+ print(", ");
+ if ( ++n >= 16 ) {
+ println();
+ print(" ");
+ n = 0;
+ }
+ }
+ }
+
+ println();
+ println(" };");
+ println();
+ }
+
+ private void emitCharMapArray() {
+ CharClasses cl = parser.getCharClasses();
+
+ if ( cl.getMaxCharCode() < 256 ) {
+ emitCharMapArrayUnPacked();
+ return;
+ }
+
+ // ignores cl.getMaxCharCode(), emits all intervals instead
+
+ intervals = cl.getIntervals();
+
+ println("");
+ println(" /** ");
+ println(" * Translates characters to character classes");
+ println(" */");
+ println(" private static final String ZZ_CMAP_PACKED = ");
+
+ int n = 0; // numbers of entries in current line
+ print(" \"");
+
+ int i = 0;
+ int count, value;
+ while ( i < intervals.length ) {
+ count = intervals[i].end-intervals[i].start+1;
+ value = colMap[intervals[i].charClass];
+
+ // count could be >= 0x10000
+ while (count > 0xFFFF) {
+ printUC(0xFFFF);
+ printUC(value);
+ count -= 0xFFFF;
+ n++;
+ }
+
+ printUC(count);
+ printUC(value);
+
+ if (i < intervals.length-1) {
+ if ( ++n >= 10 ) {
+ println("\"+");
+ print(" \"");
+ n = 0;
+ }
+ }
+
+ i++;
+ }
+
+ println("\";");
+ println();
+
+ println(" /** ");
+ println(" * Translates characters to character classes");
+ println(" */");
+ println(" private static final char [] ZZ_CMAP = zzUnpackCMap(ZZ_CMAP_PACKED);");
+ println();
+ }
+
+
+ /**
+ * Print number as octal/unicode escaped string character.
+ *
+ * @param c the value to print
+ * @prec 0 <= c <= 0xFFFF
+ */
+ private void printUC(int c) {
+ if (c > 255) {
+ out.print("\\u");
+ if (c < 0x1000) out.print("0");
+ out.print(Integer.toHexString(c));
+ }
+ else {
+ out.print("\\");
+ out.print(Integer.toOctalString(c));
+ }
+ }
+
+
+ private void emitRowMapArray() {
+ println("");
+ println(" /** ");
+ println(" * Translates a state to a row index in the transition table");
+ println(" */");
+
+ HiLowEmitter e = new HiLowEmitter("RowMap");
+ e.emitInit();
+ for (int i = 0; i < dfa.numStates; i++) {
+ e.emit(rowMap[i]*numCols);
+ }
+ e.emitUnpack();
+ println(e.toString());
+ }
+
+
+ private void emitAttributes() {
+ println(" /**");
+ println(" * ZZ_ATTRIBUTE[aState] contains the attributes of state aState
");
+ println(" */");
+
+ CountEmitter e = new CountEmitter("Attribute");
+ e.emitInit();
+
+ int count = 1;
+ int value = 0;
+ if ( dfa.isFinal[0] ) value = FINAL;
+ if ( !isTransition[0] ) value|= NOLOOK;
+
+ for (int i = 1; i < dfa.numStates; i++) {
+ int attribute = 0;
+ if ( dfa.isFinal[i] ) attribute = FINAL;
+ if ( !isTransition[i] ) attribute|= NOLOOK;
+
+ if (value == attribute) {
+ count++;
+ }
+ else {
+ e.emit(count, value);
+ count = 1;
+ value = attribute;
+ }
+ }
+
+ e.emit(count, value);
+ e.emitUnpack();
+
+ println(e.toString());
+ }
+
+
+ private void emitClassCode() {
+ if ( scanner.classCode != null ) {
+ println(" /* user code: */");
+ println(scanner.classCode);
+ }
+ }
+
+ private void emitConstructorDecl() {
+ emitConstructorDecl(true);
+
+ if ((scanner.standalone || scanner.debugOption) &&
+ scanner.ctorArgs.size() > 0) {
+ Out.warning(ErrorMessages.get(ErrorMessages.CTOR_DEBUG));
+ println();
+ emitConstructorDecl(false);
+ }
+ }
+
+ private void emitConstructorDecl(boolean printCtorArgs) {
+
+ String warn =
+ "// WARNING: this is a default constructor for " +
+ "debug/standalone only. Has no custom parameters or init code.";
+
+ if (!printCtorArgs) println(warn);
+
+ print(" ");
+
+ if ( scanner.isPublic ) print("public ");
+ print( getBaseName(scanner.className) );
+ print("(java.io.Reader in");
+ if (printCtorArgs) emitCtorArgs();
+ print(")");
+
+ if ( scanner.initThrow != null && printCtorArgs) {
+ print(" throws ");
+ print( scanner.initThrow );
+ }
+
+ println(" {");
+
+ if ( scanner.initCode != null && printCtorArgs) {
+ print(" ");
+ print( scanner.initCode );
+ }
+
+ println(" this.zzReader = in;");
+
+ println(" }");
+ println();
+
+
+ println(" /**");
+ println(" * Creates a new scanner.");
+ println(" * There is also java.io.Reader version of this constructor.");
+ println(" *");
+ println(" * @param in the java.io.Inputstream to read input from.");
+ println(" */");
+ if (!printCtorArgs) println(warn);
+
+ print(" ");
+ if ( scanner.isPublic ) print("public ");
+ print( getBaseName(scanner.className) );
+ print("(java.io.InputStream in");
+ if (printCtorArgs) emitCtorArgs();
+ print(")");
+
+ if ( scanner.initThrow != null && printCtorArgs ) {
+ print(" throws ");
+ print( scanner.initThrow );
+ }
+
+ println(" {");
+
+ print(" this(new java.io.InputStreamReader(in)");
+ if (printCtorArgs) {
+ for (int i=0; i < scanner.ctorArgs.size(); i++) {
+ print(", "+scanner.ctorArgs.elementAt(i));
+ }
+ }
+ println(");");
+
+ println(" }");
+ }
+
+ private void emitCtorArgs() {
+ for (int i = 0; i < scanner.ctorArgs.size(); i++) {
+ print(", "+scanner.ctorTypes.elementAt(i));
+ print(" "+scanner.ctorArgs.elementAt(i));
+ }
+ }
+
+ private void emitDoEOF() {
+ if ( scanner.eofCode == null ) return;
+
+ println(" /**");
+ println(" * Contains user EOF-code, which will be executed exactly once,");
+ println(" * when the end of file is reached");
+ println(" */");
+
+ print(" private void zzDoEOF()");
+
+ if ( scanner.eofThrow != null ) {
+ print(" throws ");
+ print(scanner.eofThrow);
+ }
+
+ println(" {");
+
+ println(" if (!zzEOFDone) {");
+ println(" zzEOFDone = true;");
+ println(" "+scanner.eofCode );
+ println(" }");
+ println(" }");
+ println("");
+ println("");
+ }
+
+ private void emitLexFunctHeader() {
+
+ if (scanner.cupCompatible) {
+ // force public, because we have to implement java_cup.runtime.Symbol
+ print(" public ");
+ }
+ else {
+ print(" "+visibility+" ");
+ }
+
+ if ( scanner.tokenType == null ) {
+ if ( scanner.isInteger )
+ print( "int" );
+ else
+ if ( scanner.isIntWrap )
+ print( "Integer" );
+ else
+ print( "Yytoken" );
+ }
+ else
+ print( scanner.tokenType );
+
+ print(" ");
+
+ print(scanner.functionName);
+
+ print("() throws java.io.IOException");
+
+ if ( scanner.lexThrow != null ) {
+ print(", ");
+ print(scanner.lexThrow);
+ }
+
+ if ( scanner.scanErrorException != null ) {
+ print(", ");
+ print(scanner.scanErrorException);
+ }
+
+ println(" {");
+
+ skel.emitNext();
+
+ if ( scanner.useRowMap ) {
+ println(" int [] zzTransL = ZZ_TRANS;");
+ println(" int [] zzRowMapL = ZZ_ROWMAP;");
+ println(" int [] zzAttrL = ZZ_ATTRIBUTE;");
+
+ }
+
+ skel.emitNext();
+
+ if ( scanner.charCount ) {
+ println(" yychar+= zzMarkedPosL-zzStartRead;");
+ println("");
+ }
+
+ if ( scanner.lineCount || scanner.columnCount ) {
+ println(" boolean zzR = false;");
+ println(" for (zzCurrentPosL = zzStartRead; zzCurrentPosL < zzMarkedPosL;");
+ println(" zzCurrentPosL++) {");
+ println(" switch (zzBufferL[zzCurrentPosL]) {");
+ println(" case '\\u000B':");
+ println(" case '\\u000C':");
+ println(" case '\\u0085':");
+ println(" case '\\u2028':");
+ println(" case '\\u2029':");
+ if ( scanner.lineCount )
+ println(" yyline++;");
+ if ( scanner.columnCount )
+ println(" yycolumn = 0;");
+ println(" zzR = false;");
+ println(" break;");
+ println(" case '\\r':");
+ if ( scanner.lineCount )
+ println(" yyline++;");
+ if ( scanner.columnCount )
+ println(" yycolumn = 0;");
+ println(" zzR = true;");
+ println(" break;");
+ println(" case '\\n':");
+ println(" if (zzR)");
+ println(" zzR = false;");
+ println(" else {");
+ if ( scanner.lineCount )
+ println(" yyline++;");
+ if ( scanner.columnCount )
+ println(" yycolumn = 0;");
+ println(" }");
+ println(" break;");
+ println(" default:");
+ println(" zzR = false;");
+ if ( scanner.columnCount )
+ println(" yycolumn++;");
+ println(" }");
+ println(" }");
+ println();
+
+ if ( scanner.lineCount ) {
+ println(" if (zzR) {");
+ println(" // peek one character ahead if it is \\n (if we have counted one line too much)");
+ println(" boolean zzPeek;");
+ println(" if (zzMarkedPosL < zzEndReadL)");
+ println(" zzPeek = zzBufferL[zzMarkedPosL] == '\\n';");
+ println(" else if (zzAtEOF)");
+ println(" zzPeek = false;");
+ println(" else {");
+ println(" boolean eof = zzRefill();");
+ println(" zzEndReadL = zzEndRead;");
+ println(" zzMarkedPosL = zzMarkedPos;");
+ println(" zzBufferL = zzBuffer;");
+ println(" if (eof) ");
+ println(" zzPeek = false;");
+ println(" else ");
+ println(" zzPeek = zzBufferL[zzMarkedPosL] == '\\n';");
+ println(" }");
+ println(" if (zzPeek) yyline--;");
+ println(" }");
+ }
+ }
+
+ if ( scanner.bolUsed ) {
+ // zzMarkedPos > zzStartRead <=> last match was not empty
+ // if match was empty, last value of zzAtBOL can be used
+ // zzStartRead is always >= 0
+ println(" if (zzMarkedPosL > zzStartRead) {");
+ println(" switch (zzBufferL[zzMarkedPosL-1]) {");
+ println(" case '\\n':");
+ println(" case '\\u000B':");
+ println(" case '\\u000C':");
+ println(" case '\\u0085':");
+ println(" case '\\u2028':");
+ println(" case '\\u2029':");
+ println(" zzAtBOL = true;");
+ println(" break;");
+ println(" case '\\r': ");
+ println(" if (zzMarkedPosL < zzEndReadL)");
+ println(" zzAtBOL = zzBufferL[zzMarkedPosL] != '\\n';");
+ println(" else if (zzAtEOF)");
+ println(" zzAtBOL = false;");
+ println(" else {");
+ println(" boolean eof = zzRefill();");
+ println(" zzMarkedPosL = zzMarkedPos;");
+ println(" zzEndReadL = zzEndRead;");
+ println(" zzBufferL = zzBuffer;");
+ println(" if (eof) ");
+ println(" zzAtBOL = false;");
+ println(" else ");
+ println(" zzAtBOL = zzBufferL[zzMarkedPosL] != '\\n';");
+ println(" }");
+ println(" break;");
+ println(" default:");
+ println(" zzAtBOL = false;");
+ println(" }");
+ println(" }");
+ }
+
+ skel.emitNext();
+
+ if (scanner.bolUsed) {
+ println(" if (zzAtBOL)");
+ println(" zzState = ZZ_LEXSTATE[zzLexicalState+1];");
+ println(" else");
+ println(" zzState = ZZ_LEXSTATE[zzLexicalState];");
+ println();
+ }
+ else {
+ println(" zzState = ZZ_LEXSTATE[zzLexicalState];");
+ println();
+ }
+
+ skel.emitNext();
+ }
+
+
+ private void emitGetRowMapNext() {
+ println(" int zzNext = zzTransL[ zzRowMapL[zzState] + zzCMapL[zzInput] ];");
+ println(" if (zzNext == "+DFA.NO_TARGET+") break zzForAction;");
+ println(" zzState = zzNext;");
+ println();
+
+ println(" int zzAttributes = zzAttrL[zzState];");
+
+ println(" if ( (zzAttributes & "+FINAL+") == "+FINAL+" ) {");
+
+ skel.emitNext();
+
+ println(" if ( (zzAttributes & "+NOLOOK+") == "+NOLOOK+" ) break zzForAction;");
+
+ skel.emitNext();
+ }
+
+ private void emitTransitionTable() {
+ transformTransitionTable();
+
+ println(" zzInput = zzCMapL[zzInput];");
+ println();
+
+ println(" boolean zzIsFinal = false;");
+ println(" boolean zzNoLookAhead = false;");
+ println();
+
+ println(" zzForNext: { switch (zzState) {");
+
+ for (int state = 0; state < dfa.numStates; state++)
+ if (isTransition[state]) emitState(state);
+
+ println(" default:");
+ println(" // if this is ever reached, there is a serious bug in JFlex");
+ println(" zzScanError(ZZ_UNKNOWN_ERROR);");
+ println(" break;");
+ println(" } }");
+ println();
+
+ println(" if ( zzIsFinal ) {");
+
+ skel.emitNext();
+
+ println(" if ( zzNoLookAhead ) break zzForAction;");
+
+ skel.emitNext();
+ }
+
+
+ /**
+ * Escapes all " ' \ tabs and newlines
+ */
+ private String escapify(String s) {
+ StringBuffer result = new StringBuffer(s.length()*2);
+
+ for (int i = 0; i < s.length(); i++) {
+ char c = s.charAt(i);
+ switch (c) {
+ case '\'': result.append("\\\'"); break;
+ case '\"': result.append("\\\""); break;
+ case '\\': result.append("\\\\"); break;
+ case '\t': result.append("\\t"); break;
+ case '\r': if (i+1 == s.length() || s.charAt(i+1) != '\n') result.append("\"+ZZ_NL+\"");
+ break;
+ case '\n': result.append("\"+ZZ_NL+\""); break;
+ default: result.append(c);
+ }
+ }
+
+ return result.toString();
+ }
+
+ public void emitActionTable() {
+ int lastAction = 1;
+ int count = 0;
+ int value = 0;
+
+ println(" /** ");
+ println(" * Translates DFA states to action switch labels.");
+ println(" */");
+ CountEmitter e = new CountEmitter("Action");
+ e.emitInit();
+
+ for (int i = 0; i < dfa.numStates; i++) {
+ int newVal = 0;
+ if ( dfa.isFinal[i] ) {
+ Action action = dfa.action[i];
+ if (action.isEmittable()) {
+ Integer stored = (Integer) actionTable.get(action);
+ if ( stored == null ) {
+ stored = new Integer(lastAction++);
+ actionTable.put(action, stored);
+ }
+ newVal = stored.intValue();
+ }
+ }
+
+ if (value == newVal) {
+ count++;
+ }
+ else {
+ if (count > 0) e.emit(count,value);
+ count = 1;
+ value = newVal;
+ }
+ }
+
+ if (count > 0) e.emit(count,value);
+
+ e.emitUnpack();
+ println(e.toString());
+ }
+
+ private void emitActions() {
+ println(" switch (zzAction < 0 ? zzAction : ZZ_ACTION[zzAction]) {");
+
+ int i = actionTable.size()+1;
+ Enumeration actions = actionTable.keys();
+ while ( actions.hasMoreElements() ) {
+ Action action = (Action) actions.nextElement();
+ int label = ((Integer) actionTable.get(action)).intValue();
+
+ println(" case "+label+": ");
+
+ if (action.lookAhead() == Action.FIXED_BASE) {
+ println(" // lookahead expression with fixed base length");
+ println(" zzMarkedPos = zzStartRead + "+action.getLookLength()+";");
+ }
+
+ if (action.lookAhead() == Action.FIXED_LOOK ||
+ action.lookAhead() == Action.FINITE_CHOICE) {
+ println(" // lookahead expression with fixed lookahead length");
+ println(" yypushback("+action.getLookLength()+");");
+ }
+
+ if (action.lookAhead() == Action.GENERAL_LOOK) {
+ println(" // general lookahead, find correct zzMarkedPos");
+ println(" { int zzFState = "+dfa.entryState[action.getEntryState()]+";");
+ println(" int zzFPos = zzStartRead;");
+ println(" if (zzFin.length <= zzBufferL.length) { zzFin = new boolean[zzBufferL.length+1]; }");
+ println(" boolean zzFinL[] = zzFin;");
+ println(" while (zzFState != -1 && zzFPos < zzMarkedPos) {");
+ println(" if ((zzAttrL[zzFState] & 1) == 1) { zzFinL[zzFPos] = true; } ");
+ println(" zzInput = zzBufferL[zzFPos++];");
+ println(" zzFState = zzTransL[ zzRowMapL[zzFState] + zzCMapL[zzInput] ];");
+ println(" }");
+ println(" if (zzFState != -1 && (zzAttrL[zzFState] & 1) == 1) { zzFinL[zzFPos] = true; } ");
+ println();
+ println(" zzFState = "+dfa.entryState[action.getEntryState()+1]+";");
+ println(" zzFPos = zzMarkedPos;");
+ println(" while (!zzFinL[zzFPos] || (zzAttrL[zzFState] & 1) != 1) {");
+ println(" zzInput = zzBufferL[--zzFPos];");
+ println(" zzFState = zzTransL[ zzRowMapL[zzFState] + zzCMapL[zzInput] ];");
+ println(" };");
+ println(" zzMarkedPos = zzFPos;");
+ println(" }");
+ }
+
+ if ( scanner.debugOption ) {
+ print(" System.out.println(");
+ if ( scanner.lineCount )
+ print("\"line: \"+(yyline+1)+\" \"+");
+ if ( scanner.columnCount )
+ print("\"col: \"+(yycolumn+1)+\" \"+");
+ println("\"match: --\"+yytext()+\"--\");");
+ print(" System.out.println(\"action ["+action.priority+"] { ");
+ print(escapify(action.content));
+ println(" }\");");
+ }
+
+ println(" { "+action.content);
+ println(" }");
+ println(" case "+(i++)+": break;");
+ }
+ }
+
+ private void emitEOFVal() {
+ EOFActions eofActions = parser.getEOFActions();
+
+ if ( scanner.eofCode != null )
+ println(" zzDoEOF();");
+
+ if ( eofActions.numActions() > 0 ) {
+ println(" switch (zzLexicalState) {");
+
+ Enumeration stateNames = scanner.states.names();
+
+ // record lex states already emitted:
+ Hashtable used = new Hashtable();
+
+ // pick a start value for break case labels.
+ // must be larger than any value of a lex state:
+ int last = dfa.numStates;
+
+ while ( stateNames.hasMoreElements() ) {
+ String name = (String) stateNames.nextElement();
+ int num = scanner.states.getNumber(name).intValue();
+ Action action = eofActions.getAction(num);
+
+ if (action != null) {
+ println(" case "+name+": {");
+ if ( scanner.debugOption ) {
+ print(" System.out.println(");
+ if ( scanner.lineCount )
+ print("\"line: \"+(yyline+1)+\" \"+");
+ if ( scanner.columnCount )
+ print("\"col: \"+(yycolumn+1)+\" \"+");
+ println("\"match: <>\");");
+ print(" System.out.println(\"action ["+action.priority+"] { ");
+ print(escapify(action.content));
+ println(" }\");");
+ }
+ println(" "+action.content);
+ println(" }");
+ println(" case "+(++last)+": break;");
+ }
+ }
+
+ println(" default:");
+ }
+
+ Action defaultAction = eofActions.getDefault();
+
+ if (defaultAction != null) {
+ println(" {");
+ if ( scanner.debugOption ) {
+ print(" System.out.println(");
+ if ( scanner.lineCount )
+ print("\"line: \"+(yyline+1)+\" \"+");
+ if ( scanner.columnCount )
+ print("\"col: \"+(yycolumn+1)+\" \"+");
+ println("\"match: <>\");");
+ print(" System.out.println(\"action ["+defaultAction.priority+"] { ");
+ print(escapify(defaultAction.content));
+ println(" }\");");
+ }
+ println(" " + defaultAction.content);
+ println(" }");
+ }
+ else if ( scanner.eofVal != null )
+ println(" { " + scanner.eofVal + " }");
+ else if ( scanner.isInteger ) {
+ if ( scanner.tokenType != null ) {
+ Out.error(ErrorMessages.INT_AND_TYPE);
+ throw new GeneratorException();
+ }
+ println(" return YYEOF;");
+ }
+ else
+ println(" return null;");
+
+ if (eofActions.numActions() > 0)
+ println(" }");
+ }
+
+ private void emitState(int state) {
+
+ println(" case "+state+":");
+ println(" switch (zzInput) {");
+
+ int defaultTransition = getDefaultTransition(state);
+
+ for (int next = 0; next < dfa.numStates; next++) {
+
+ if ( next != defaultTransition && table[state][next] != null ) {
+ emitTransition(state, next);
+ }
+ }
+
+ if ( defaultTransition != DFA.NO_TARGET && noTarget[state] != null ) {
+ emitTransition(state, DFA.NO_TARGET);
+ }
+
+ emitDefaultTransition(state, defaultTransition);
+
+ println(" }");
+ println("");
+ }
+
+ private void emitTransition(int state, int nextState) {
+
+ CharSetEnumerator chars;
+
+ if (nextState != DFA.NO_TARGET)
+ chars = table[state][nextState].characters();
+ else
+ chars = noTarget[state].characters();
+
+ print(" case ");
+ print(chars.nextElement());
+ print(": ");
+
+ while ( chars.hasMoreElements() ) {
+ println();
+ print(" case ");
+ print(chars.nextElement());
+ print(": ");
+ }
+
+ if ( nextState != DFA.NO_TARGET ) {
+ if ( dfa.isFinal[nextState] )
+ print("zzIsFinal = true; ");
+
+ if ( !isTransition[nextState] )
+ print("zzNoLookAhead = true; ");
+
+ if ( nextState == state )
+ println("break zzForNext;");
+ else
+ println("zzState = "+nextState+"; break zzForNext;");
+ }
+ else
+ println("break zzForAction;");
+ }
+
+ private void emitDefaultTransition(int state, int nextState) {
+ print(" default: ");
+
+ if ( nextState != DFA.NO_TARGET ) {
+ if ( dfa.isFinal[nextState] )
+ print("zzIsFinal = true; ");
+
+ if ( !isTransition[nextState] )
+ print("zzNoLookAhead = true; ");
+
+ if ( nextState == state )
+ println("break zzForNext;");
+ else
+ println("zzState = "+nextState+"; break zzForNext;");
+ }
+ else
+ println( "break zzForAction;" );
+ }
+
+ private int getDefaultTransition(int state) {
+ int max = 0;
+
+ for (int i = 0; i < dfa.numStates; i++) {
+ if ( table[state][max] == null )
+ max = i;
+ else
+ if ( table[state][i] != null && table[state][max].size() < table[state][i].size() )
+ max = i;
+ }
+
+ if ( table[state][max] == null ) return DFA.NO_TARGET;
+ if ( noTarget[state] == null ) return max;
+
+ if ( table[state][max].size() < noTarget[state].size() )
+ max = DFA.NO_TARGET;
+
+ return max;
+ }
+
+ // for switch statement:
+ private void transformTransitionTable() {
+
+ int numInput = parser.getCharClasses().getNumClasses()+1;
+
+ int i;
+ char j;
+
+ table = new CharSet[dfa.numStates][dfa.numStates];
+ noTarget = new CharSet[dfa.numStates];
+
+ for (i = 0; i < dfa.numStates; i++)
+ for (j = 0; j < dfa.numInput; j++) {
+
+ int nextState = dfa.table[i][j];
+
+ if ( nextState == DFA.NO_TARGET ) {
+ if ( noTarget[i] == null )
+ noTarget[i] = new CharSet(numInput, colMap[j]);
+ else
+ noTarget[i].add(colMap[j]);
+ }
+ else {
+ if ( table[i][nextState] == null )
+ table[i][nextState] = new CharSet(numInput, colMap[j]);
+ else
+ table[i][nextState].add(colMap[j]);
+ }
+ }
+ }
+
+ private void findActionStates() {
+ isTransition = new boolean [dfa.numStates];
+
+ for (int i = 0; i < dfa.numStates; i++) {
+ char j = 0;
+ while ( !isTransition[i] && j < dfa.numInput )
+ isTransition[i] = dfa.table[i][j++] != DFA.NO_TARGET;
+ }
+ }
+
+
+ private void reduceColumns() {
+ colMap = new int [dfa.numInput];
+ colKilled = new boolean [dfa.numInput];
+
+ int i,j,k;
+ int translate = 0;
+ boolean equal;
+
+ numCols = dfa.numInput;
+
+ for (i = 0; i < dfa.numInput; i++) {
+
+ colMap[i] = i-translate;
+
+ for (j = 0; j < i; j++) {
+
+ // test for equality:
+ k = -1;
+ equal = true;
+ while (equal && ++k < dfa.numStates)
+ equal = dfa.table[k][i] == dfa.table[k][j];
+
+ if (equal) {
+ translate++;
+ colMap[i] = colMap[j];
+ colKilled[i] = true;
+ numCols--;
+ break;
+ } // if
+ } // for j
+ } // for i
+ }
+
+ private void reduceRows() {
+ rowMap = new int [dfa.numStates];
+ rowKilled = new boolean [dfa.numStates];
+
+ int i,j,k;
+ int translate = 0;
+ boolean equal;
+
+ numRows = dfa.numStates;
+
+ // i is the state to add to the new table
+ for (i = 0; i < dfa.numStates; i++) {
+
+ rowMap[i] = i-translate;
+
+ // check if state i can be removed (i.e. already
+ // exists in entries 0..i-1)
+ for (j = 0; j < i; j++) {
+
+ // test for equality:
+ k = -1;
+ equal = true;
+ while (equal && ++k < dfa.numInput)
+ equal = dfa.table[i][k] == dfa.table[j][k];
+
+ if (equal) {
+ translate++;
+ rowMap[i] = rowMap[j];
+ rowKilled[i] = true;
+ numRows--;
+ break;
+ } // if
+ } // for j
+ } // for i
+
+ }
+
+
+ /**
+ * Set up EOF code section according to scanner.eofcode
+ */
+ private void setupEOFCode() {
+ if (scanner.eofclose) {
+ scanner.eofCode = LexScan.conc(scanner.eofCode, " yyclose();");
+ scanner.eofThrow = LexScan.concExc(scanner.eofThrow, "java.io.IOException");
+ }
+ }
+
+
+ /**
+ * Main Emitter method.
+ */
+ public void emit() {
+
+ setupEOFCode();
+
+ if (scanner.functionName == null)
+ scanner.functionName = "yylex";
+
+ reduceColumns();
+ findActionStates();
+
+ emitHeader();
+ emitUserCode();
+ emitClassName();
+
+ skel.emitNext();
+
+ println(" private static final int ZZ_BUFFERSIZE = "+scanner.bufferSize+";");
+
+ if (scanner.debugOption) {
+ println(" private static final String ZZ_NL = System.getProperty(\"line.separator\");");
+ }
+
+ skel.emitNext();
+
+ emitLexicalStates();
+
+ emitCharMapArray();
+
+ emitActionTable();
+
+ if (scanner.useRowMap) {
+ reduceRows();
+
+ emitRowMapArray();
+
+ if (scanner.packed)
+ emitDynamicInit();
+ else
+ emitZZTrans();
+ }
+
+ skel.emitNext();
+
+ if (scanner.useRowMap)
+ emitAttributes();
+
+ skel.emitNext();
+
+ emitLookBuffer();
+
+ emitClassCode();
+
+ skel.emitNext();
+
+ emitConstructorDecl();
+
+ emitCharMapInitFunction();
+
+ skel.emitNext();
+
+ emitScanError();
+
+ skel.emitNext();
+
+ emitDoEOF();
+
+ skel.emitNext();
+
+ emitLexFunctHeader();
+
+ emitNextInput();
+
+ if (scanner.useRowMap)
+ emitGetRowMapNext();
+ else
+ emitTransitionTable();
+
+ skel.emitNext();
+
+ emitActions();
+
+ skel.emitNext();
+
+ emitEOFVal();
+
+ skel.emitNext();
+
+ emitNoMatch();
+
+ skel.emitNext();
+
+ emitMain();
+
+ skel.emitNext();
+
+ out.close();
+ }
+
+}
Index: /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/src/JFlex/ErrorMessages.java
===================================================================
--- /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/src/JFlex/ErrorMessages.java (revision 25585)
+++ /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/src/JFlex/ErrorMessages.java (revision 25585)
@@ -0,0 +1,149 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * JFlex 1.4.3 *
+ * Copyright (C) 1998-2009 Gerwin Klein *
+ * All rights reserved. *
+ * *
+ * This program is free software); you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License. See the file *
+ * COPYRIGHT for more information. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY); without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License along *
+ * with this program); if not, write to the Free Software Foundation, Inc., *
+ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *
+ * *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+package JFlex;
+
+import java.text.MessageFormat;
+import java.util.MissingResourceException;
+import java.util.ResourceBundle;
+
+
+/**
+ * Central class for all kinds of JFlex messages.
+ *
+ * [Is not yet used exclusively, but should]
+ *
+ * @author Gerwin Klein
+ * @version JFlex 1.4.3, $Revision: 433 $, $Date: 2009-01-31 19:52:34 +1100 (Sat, 31 Jan 2009) $
+ */
+public class ErrorMessages {
+ private String key;
+
+ /* not final static, because initializing here seems too early
+ * for OS/2 JDK 1.1.8. See bug 1065521.
+ */
+ private static ResourceBundle resourceBundle = null;
+
+ private ErrorMessages(String key) {
+ this.key = key;
+ }
+
+ public static String get(ErrorMessages msg) {
+ if (resourceBundle == null) {
+ resourceBundle = ResourceBundle.getBundle("JFlex.Messages");
+ }
+ try {
+ return resourceBundle.getString(msg.key);
+ } catch (MissingResourceException e) {
+ return '!' + msg.key + '!';
+ }
+ }
+
+ public static String get(ErrorMessages msg, String data) {
+ Object [] args = { data };
+ return MessageFormat.format(get(msg),args);
+ }
+
+ public static String get(ErrorMessages msg, String data1, String data2) {
+ Object [] args = { data1, data2 };
+ return MessageFormat.format(get(msg),args);
+ }
+
+ public static String get(ErrorMessages msg, int data) {
+ Object [] args = { new Integer(data) };
+ return MessageFormat.format(get(msg),args);
+ }
+
+ // typesafe enumeration (generated, do not edit)
+ public static ErrorMessages UNTERMINATED_STR = new ErrorMessages("UNTERMINATED_STR");
+ public static ErrorMessages EOF_WO_ACTION = new ErrorMessages("EOF_WO_ACTION");
+ public static ErrorMessages EOF_SINGLERULE = new ErrorMessages("EOF_SINGLERULE");
+ public static ErrorMessages UNKNOWN_OPTION = new ErrorMessages("UNKNOWN_OPTION");
+ public static ErrorMessages UNEXPECTED_CHAR = new ErrorMessages("UNEXPECTED_CHAR");
+ public static ErrorMessages UNEXPECTED_NL = new ErrorMessages("UNEXPECTED_NL");
+ public static ErrorMessages LEXSTATE_UNDECL = new ErrorMessages("LEXSTATE_UNDECL");
+ public static ErrorMessages STATE_IDENT_EXP = new ErrorMessages("STATE_IDENT_EXP");
+ public static ErrorMessages REPEAT_ZERO = new ErrorMessages("REPEAT_ZERO");
+ public static ErrorMessages REPEAT_GREATER = new ErrorMessages("REPEAT_GREATER");
+ public static ErrorMessages REGEXP_EXPECTED = new ErrorMessages("REGEXP_EXPECTED");
+ public static ErrorMessages MACRO_UNDECL = new ErrorMessages("MACRO_UNDECL");
+ public static ErrorMessages CHARSET_2_SMALL = new ErrorMessages("CHARSET_2_SMALL");
+ public static ErrorMessages CS2SMALL_STRING = new ErrorMessages("CS2SMALL_STRING");
+ public static ErrorMessages CS2SMALL_CHAR = new ErrorMessages("CS2SMALL_CHAR");
+ public static ErrorMessages CHARCLASS_MACRO = new ErrorMessages("CHARCLASS_MACRO");
+ public static ErrorMessages UNKNOWN_SYNTAX = new ErrorMessages("UNKNOWN_SYNTAX");
+ public static ErrorMessages SYNTAX_ERROR = new ErrorMessages("SYNTAX_ERROR");
+ public static ErrorMessages NOT_AT_BOL = new ErrorMessages("NOT_AT_BOL");
+ public static ErrorMessages NO_MATCHING_BR = new ErrorMessages("NO_MATCHING_BR");
+ public static ErrorMessages EOF_IN_ACTION = new ErrorMessages("EOF_IN_ACTION");
+ public static ErrorMessages EOF_IN_COMMENT = new ErrorMessages("EOF_IN_COMMENT");
+ public static ErrorMessages EOF_IN_STRING = new ErrorMessages("EOF_IN_STRING");
+ public static ErrorMessages EOF_IN_MACROS = new ErrorMessages("EOF_IN_MACROS");
+ public static ErrorMessages EOF_IN_STATES = new ErrorMessages("EOF_IN_STATES");
+ public static ErrorMessages EOF_IN_REGEXP = new ErrorMessages("EOF_IN_REGEXP");
+ public static ErrorMessages UNEXPECTED_EOF = new ErrorMessages("UNEXPECTED_EOF");
+ public static ErrorMessages NO_LEX_SPEC = new ErrorMessages("NO_LEX_SPEC");
+ public static ErrorMessages NO_LAST_ACTION = new ErrorMessages("NO_LAST_ACTION");
+ public static ErrorMessages NO_DIRECTORY = new ErrorMessages("NO_DIRECTORY");
+ public static ErrorMessages NO_SKEL_FILE = new ErrorMessages("NO_SKEL_FILE");
+ public static ErrorMessages WRONG_SKELETON = new ErrorMessages("WRONG_SKELETON");
+ public static ErrorMessages OUT_OF_MEMORY = new ErrorMessages("OUT_OF_MEMORY");
+ public static ErrorMessages QUIL_INITTHROW = new ErrorMessages("QUIL_INITTHROW");
+ public static ErrorMessages QUIL_EOFTHROW = new ErrorMessages("QUIL_EOFTHROW");
+ public static ErrorMessages QUIL_YYLEXTHROW = new ErrorMessages("QUIL_YYLEXTHROW");
+ public static ErrorMessages ZERO_STATES = new ErrorMessages("ZERO_STATES");
+ public static ErrorMessages NO_BUFFER_SIZE = new ErrorMessages("NO_BUFFER_SIZE");
+ public static ErrorMessages NOT_READABLE = new ErrorMessages("NOT_READABLE");
+ public static ErrorMessages FILE_CYCLE = new ErrorMessages("FILE_CYCLE");
+ public static ErrorMessages FILE_WRITE = new ErrorMessages("FILE_WRITE");
+ public static ErrorMessages QUIL_SCANERROR = new ErrorMessages("QUIL_SCANERROR");
+ public static ErrorMessages NEVER_MATCH = new ErrorMessages("NEVER_MATCH");
+ public static ErrorMessages QUIL_THROW = new ErrorMessages("QUIL_THROW");
+ public static ErrorMessages EOL_IN_CHARCLASS = new ErrorMessages("EOL_IN_CHARCLASS");
+ public static ErrorMessages QUIL_CUPSYM = new ErrorMessages("QUIL_CUPSYM");
+ public static ErrorMessages CUPSYM_AFTER_CUP = new ErrorMessages("CUPSYM_AFTER_CUP");
+ public static ErrorMessages ALREADY_RUNNING = new ErrorMessages("ALREADY_RUNNING");
+ public static ErrorMessages CANNOT_READ_SKEL = new ErrorMessages("CANNOT_READ_SKEL");
+ public static ErrorMessages READING_SKEL = new ErrorMessages("READING_SKEL");
+ public static ErrorMessages SKEL_IO_ERROR = new ErrorMessages("SKEL_IO_ERROR");
+ public static ErrorMessages SKEL_IO_ERROR_DEFAULT = new ErrorMessages("SKEL_IO_ERROR_DEFAULT");
+ public static ErrorMessages READING = new ErrorMessages("READING");
+ public static ErrorMessages CANNOT_OPEN = new ErrorMessages("CANNOT_OPEN");
+ public static ErrorMessages NFA_IS = new ErrorMessages("NFA_IS");
+ public static ErrorMessages NFA_STATES = new ErrorMessages("NFA_STATES");
+ public static ErrorMessages DFA_TOOK = new ErrorMessages("DFA_TOOK");
+ public static ErrorMessages DFA_IS = new ErrorMessages("DFA_IS");
+ public static ErrorMessages MIN_TOOK = new ErrorMessages("MIN_TOOK");
+ public static ErrorMessages MIN_DFA_IS = new ErrorMessages("MIN_DFA_IS");
+ public static ErrorMessages WRITE_TOOK = new ErrorMessages("WRITE_TOOK");
+ public static ErrorMessages TOTAL_TIME = new ErrorMessages("TOTAL_TIME");
+ public static ErrorMessages IO_ERROR = new ErrorMessages("IO_ERROR");
+ public static ErrorMessages THIS_IS_JFLEX = new ErrorMessages("THIS_IS_JFLEX");
+ public static ErrorMessages UNKNOWN_COMMANDLINE = new ErrorMessages("UNKNOWN_COMMANDLINE");
+ public static ErrorMessages MACRO_CYCLE = new ErrorMessages("MACRO_CYCLE");
+ public static ErrorMessages MACRO_DEF_MISSING = new ErrorMessages("MACRO_DEF_MISSING");
+ public static ErrorMessages PARSING_TOOK = new ErrorMessages("PARSING_TOOK");
+ public static ErrorMessages NFA_TOOK = new ErrorMessages("NFA_TOOK");
+ public static ErrorMessages LOOKAHEAD_NEEDS_ACTION = new ErrorMessages("LOOKAHEAD_NEEDS_ACTION");
+ public static ErrorMessages EMPTY_MATCH = new ErrorMessages("EMPTY_MATCH");
+ public static ErrorMessages CTOR_ARG = new ErrorMessages("CTOR_ARG");
+ public static ErrorMessages CTOR_DEBUG = new ErrorMessages("CTOR_DEBUG");
+ public static ErrorMessages INT_AND_TYPE = new ErrorMessages("INT_AND_TYPE");
+}
Index: /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/src/JFlex/GeneratorException.java
===================================================================
--- /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/src/JFlex/GeneratorException.java (revision 25585)
+++ /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/src/JFlex/GeneratorException.java (revision 25585)
@@ -0,0 +1,36 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * JFlex 1.4.3 *
+ * Copyright (C) 1998-2009 Gerwin Klein *
+ * All rights reserved. *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License. See the file *
+ * COPYRIGHT for more information. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License along *
+ * with this program; if not, write to the Free Software Foundation, Inc., *
+ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *
+ * *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+package JFlex;
+
+
+/**
+ * Thrown when code generation has to be aborted.
+ *
+ * @author Gerwin Klein
+ * @version JFlex 1.4.3, $Revision: 433 $, $Date: 2009-01-31 19:52:34 +1100 (Sat, 31 Jan 2009) $
+ */
+public class GeneratorException extends RuntimeException {
+
+ public GeneratorException() {
+ super("Generation aborted");
+ }
+
+}
Index: /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/src/JFlex/HiLowEmitter.java
===================================================================
--- /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/src/JFlex/HiLowEmitter.java (revision 25585)
+++ /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/src/JFlex/HiLowEmitter.java (revision 25585)
@@ -0,0 +1,88 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * jflex *
+ * Copyright (C) 1998-2009 Gerwin Klein *
+ * All rights reserved. *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License. See the file *
+ * COPYRIGHT for more information. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License along *
+ * with this program; if not, write to the Free Software Foundation, Inc., *
+ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *
+ * *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+package JFlex;
+
+/**
+ * HiLowEmitter
+ *
+ * @author Gerwin Klein
+ * @version $Revision: 433 $, $Date: 2009-01-31 19:52:34 +1100 (Sat, 31 Jan 2009) $
+ */
+public class HiLowEmitter extends PackEmitter {
+
+ /** number of entries in expanded array */
+ private int numEntries;
+
+ /**
+ * Create new emitter for values in [0, 0xFFFFFFFF] using hi/low encoding.
+ *
+ * @param name the name of the generated array
+ */
+ public HiLowEmitter(String name) {
+ super(name);
+ }
+
+ /**
+ * Emits hi/low pair unpacking code for the generated array.
+ *
+ * @see JFlex.PackEmitter#emitUnPack()
+ */
+ public void emitUnpack() {
+ // close last string chunk:
+ println("\";");
+ nl();
+ println(" private static int [] zzUnpack"+name+"() {");
+ println(" int [] result = new int["+numEntries+"];");
+ println(" int offset = 0;");
+
+ for (int i = 0; i < chunks; i++) {
+ println(" offset = zzUnpack"+name+"("+constName()+"_PACKED_"+i+", offset, result);");
+ }
+
+ println(" return result;");
+ println(" }");
+
+ nl();
+ println(" private static int zzUnpack"+name+"(String packed, int offset, int [] result) {");
+ println(" int i = 0; /* index in packed string */");
+ println(" int j = offset; /* index in unpacked array */");
+ println(" int l = packed.length();");
+ println(" while (i < l) {");
+ println(" int high = packed.charAt(i++) << 16;");
+ println(" result[j++] = high | packed.charAt(i++);");
+ println(" }");
+ println(" return j;");
+ println(" }");
+ }
+
+ /**
+ * Emit one value using two characters.
+ *
+ * @param val the value to emit
+ * @prec 0 <= val <= 0xFFFFFFFF
+ */
+ public void emit(int val) {
+ numEntries+= 1;
+ breaks();
+ emitUC(val >> 16);
+ emitUC(val & 0xFFFF);
+ }
+}
Index: /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/src/JFlex/IntCharSet.java
===================================================================
--- /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/src/JFlex/IntCharSet.java (revision 25585)
+++ /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/src/JFlex/IntCharSet.java (revision 25585)
@@ -0,0 +1,411 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * JFlex 1.4.3 *
+ * Copyright (C) 1998-2009 Gerwin Klein *
+ * All rights reserved. *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License. See the file *
+ * COPYRIGHT for more information. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License along *
+ * with this program; if not, write to the Free Software Foundation, Inc., *
+ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *
+ * *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+package JFlex;
+
+import java.util.*;
+
+
+/**
+ * CharSet implemented with intervalls
+ *
+ * [fixme: optimizations possible]
+ *
+ * @author Gerwin Klein
+ * @version JFlex 1.4.3, $Revision: 433 $, $Date: 2009-01-31 19:52:34 +1100 (Sat, 31 Jan 2009) $
+ */
+public final class IntCharSet {
+
+ private final static boolean DEBUG = false;
+
+ /* invariant: all intervals are disjoint, ordered */
+ private Vector intervalls;
+ private int pos;
+
+ public IntCharSet() {
+ this.intervalls = new Vector();
+ }
+
+ public IntCharSet(char c) {
+ this(new Interval(c,c));
+ }
+
+ public IntCharSet(Interval intervall) {
+ this();
+ intervalls.addElement(intervall);
+ }
+
+ public IntCharSet(Vector /* Interval */ chars) {
+ int size = chars.size();
+
+ this.intervalls = new Vector(size);
+
+ for (int i = 0; i < size; i++)
+ add( (Interval) chars.elementAt(i) );
+ }
+
+
+
+
+ /**
+ * returns the index of the intervall that contains
+ * the character c, -1 if there is no such intevall
+ *
+ * @prec: true
+ * @post: -1 <= return < intervalls.size() &&
+ * (return > -1 --> intervalls[return].contains(c))
+ *
+ * @param c the character
+ * @return the index of the enclosing interval, -1 if no such interval
+ */
+ private int indexOf(char c) {
+ int start = 0;
+ int end = intervalls.size()-1;
+
+ while (start <= end) {
+ int check = (start+end) / 2;
+ Interval i = (Interval) intervalls.elementAt(check);
+
+ if (start == end)
+ return i.contains(c) ? start : -1;
+
+ if (c < i.start) {
+ end = check-1;
+ continue;
+ }
+
+ if (c > i.end) {
+ start = check+1;
+ continue;
+ }
+
+ return check;
+ }
+
+ return -1;
+ }
+
+ public IntCharSet add(IntCharSet set) {
+ for (int i = 0; i < set.intervalls.size(); i++)
+ add( (Interval) set.intervalls.elementAt(i) );
+ return this;
+ }
+
+ public void add(Interval intervall) {
+
+ int size = intervalls.size();
+
+ for (int i = 0; i < size; i++) {
+ Interval elem = (Interval) intervalls.elementAt(i);
+
+ if ( elem.end+1 < intervall.start ) continue;
+
+ if ( elem.contains(intervall) ) return;
+
+ if ( elem.start > intervall.end+1 ) {
+ intervalls.insertElementAt(new Interval(intervall), i);
+ return;
+ }
+
+ if (intervall.start < elem.start)
+ elem.start = intervall.start;
+
+ if (intervall.end <= elem.end)
+ return;
+
+ elem.end = intervall.end;
+
+ i++;
+ // delete all x with x.contains( intervall.end )
+ while (i < size) {
+ Interval x = (Interval) intervalls.elementAt(i);
+ if (x.start > elem.end+1) return;
+
+ elem.end = x.end;
+ intervalls.removeElementAt(i);
+ size--;
+ }
+ return;
+ }
+
+ intervalls.addElement(new Interval(intervall));
+ }
+
+ public void add(char c) {
+ int size = intervalls.size();
+
+ for (int i = 0; i < size; i++) {
+ Interval elem = (Interval) intervalls.elementAt(i);
+ if (elem.end+1 < c) continue;
+
+ if (elem.contains(c)) return; // already there, nothing to do
+
+ // assert(elem.end+1 >= c && (elem.start > c || elem.end < c));
+
+ if (elem.start > c+1) {
+ intervalls.insertElementAt(new Interval(c,c), i);
+ return;
+ }
+
+ // assert(elem.end+1 >= c && elem.start <= c+1 && (elem.start > c || elem.end < c));
+
+ if (c+1 == elem.start) {
+ elem.start = c;
+ return;
+ }
+
+ // assert(elem.end+1 == c);
+ elem.end = c;
+
+ // merge with next interval if it contains c
+ if (i+1 >= size) return;
+ Interval x = (Interval) intervalls.elementAt(i+1);
+ if (x.start <= c+1) {
+ elem.end = x.end;
+ intervalls.removeElementAt(i+1);
+ }
+ return;
+ }
+
+ // end reached but nothing found -> append at end
+ intervalls.addElement(new Interval(c,c));
+ }
+
+
+ public boolean contains(char singleChar) {
+ return indexOf(singleChar) >= 0;
+ }
+
+
+ /**
+ * o instanceof Interval
+ */
+ public boolean equals(Object o) {
+ IntCharSet set = (IntCharSet) o;
+ if ( intervalls.size() != set.intervalls.size() ) return false;
+
+ for (int i = 0; i < intervalls.size(); i++) {
+ if ( !intervalls.elementAt(i).equals( set.intervalls.elementAt(i)) )
+ return false;
+ }
+
+ return true;
+ }
+
+ private char min(char a, char b) {
+ return a <= b ? a : b;
+ }
+
+ private char max(char a, char b) {
+ return a >= b ? a : b;
+ }
+
+ /* intersection */
+ public IntCharSet and(IntCharSet set) {
+ if (DEBUG) {
+ Out.dump("intersection");
+ Out.dump("this : "+this);
+ Out.dump("other : "+set);
+ }
+
+ IntCharSet result = new IntCharSet();
+
+ int i = 0; // index in this.intervalls
+ int j = 0; // index in set.intervalls
+
+ int size = intervalls.size();
+ int setSize = set.intervalls.size();
+
+ while (i < size && j < setSize) {
+ Interval x = (Interval) this.intervalls.elementAt(i);
+ Interval y = (Interval) set.intervalls.elementAt(j);
+
+ if (x.end < y.start) {
+ i++;
+ continue;
+ }
+
+ if (y.end < x.start) {
+ j++;
+ continue;
+ }
+
+ result.intervalls.addElement(
+ new Interval(
+ max(x.start, y.start),
+ min(x.end, y.end)
+ )
+ );
+
+ if (x.end >= y.end) j++;
+ if (y.end >= x.end) i++;
+ }
+
+ if (DEBUG) {
+ Out.dump("result: "+result);
+ }
+
+ return result;
+ }
+
+ /* complement */
+ /* prec: this.contains(set), set != null */
+ public void sub(IntCharSet set) {
+ if (DEBUG) {
+ Out.dump("complement");
+ Out.dump("this : "+this);
+ Out.dump("other : "+set);
+ }
+
+ int i = 0; // index in this.intervalls
+ int j = 0; // index in set.intervalls
+
+ int setSize = set.intervalls.size();
+
+ while (i < intervalls.size() && j < setSize) {
+ Interval x = (Interval) this.intervalls.elementAt(i);
+ Interval y = (Interval) set.intervalls.elementAt(j);
+
+ if (DEBUG) {
+ Out.dump("this : "+this);
+ Out.dump("this ["+i+"] : "+x);
+ Out.dump("other ["+j+"] : "+y);
+ }
+
+ if (x.end < y.start) {
+ i++;
+ continue;
+ }
+
+ if (y.end < x.start) {
+ j++;
+ continue;
+ }
+
+ // x.end >= y.start && y.end >= x.start ->
+ // x.end <= y.end && x.start >= y.start (prec)
+
+ if ( x.start == y.start && x.end == y.end ) {
+ intervalls.removeElementAt(i);
+ j++;
+ continue;
+ }
+
+ // x.end <= y.end && x.start >= y.start &&
+ // (x.end < y.end || x.start > y.start) ->
+ // x.start < x.end
+
+ if ( x.start == y.start ) {
+ x.start = (char) (y.end+1);
+ j++;
+ continue;
+ }
+
+ if ( x.end == y.end ) {
+ x.end = (char) (y.start-1);
+ i++;
+ j++;
+ continue;
+ }
+
+ intervalls.insertElementAt(new Interval(x.start, (char) (y.start-1)), i);
+ x.start = (char) (y.end+1);
+
+ i++;
+ j++;
+ }
+
+ if (DEBUG) {
+ Out.dump("result: "+this);
+ }
+ }
+
+ public boolean containsElements() {
+ return intervalls.size() > 0;
+ }
+
+ public int numIntervalls() {
+ return intervalls.size();
+ }
+
+ // beware: depends on caller protocol, single user only
+ public Interval getNext() {
+ if (pos == intervalls.size()) pos = 0;
+ return (Interval) intervalls.elementAt(pos++);
+ }
+
+ /**
+ * Create a caseless version of this charset.
+ *
+ * The caseless version contains all characters of this char set,
+ * and additionally all lower/upper/title case variants of the
+ * characters in this set.
+ *
+ * @return a caseless copy of this set
+ */
+ public IntCharSet getCaseless() {
+ IntCharSet n = copy();
+
+ int size = intervalls.size();
+ for (int i=0; i < size; i++) {
+ Interval elem = (Interval) intervalls.elementAt(i);
+ for (char c = elem.start; c <= elem.end; c++) {
+ n.add(Character.toLowerCase(c));
+ n.add(Character.toUpperCase(c));
+ n.add(Character.toTitleCase(c));
+ }
+ }
+
+ return n;
+ }
+
+
+ /**
+ * Make a string representation of this char set.
+ *
+ * @return a string representing this char set.
+ */
+ public String toString() {
+ StringBuffer result = new StringBuffer("{ ");
+
+ for (int i = 0; i < intervalls.size(); i++)
+ result.append( intervalls.elementAt(i) );
+
+ result.append(" }");
+
+ return result.toString();
+ }
+
+
+ /**
+ * Return a (deep) copy of this char set
+ *
+ * @return the copy
+ */
+ public IntCharSet copy() {
+ IntCharSet result = new IntCharSet();
+ int size = intervalls.size();
+ for (int i=0; i < size; i++) {
+ Interval iv = ((Interval) intervalls.elementAt(i)).copy();
+ result.intervalls.addElement(iv);
+ }
+ return result;
+ }
+}
Index: /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/src/JFlex/IntPair.java
===================================================================
--- /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/src/JFlex/IntPair.java (revision 25585)
+++ /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/src/JFlex/IntPair.java (revision 25585)
@@ -0,0 +1,57 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * JFlex 1.4.3 *
+ * Copyright (C) 1998-2009 Gerwin Klein *
+ * All rights reserved. *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License. See the file *
+ * COPYRIGHT for more information. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License along *
+ * with this program; if not, write to the Free Software Foundation, Inc., *
+ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *
+ * *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+package JFlex;
+
+
+/**
+ * Simple pair of integers.
+ *
+ * Used in NFA to represent a partial NFA by its start and end state.
+ *
+ * @author Gerwin Klein
+ * @version JFlex 1.4.3, $Revision: 433 $, $Date: 2009-01-31 19:52:34 +1100 (Sat, 31 Jan 2009) $
+ */
+final class IntPair {
+
+ int start;
+ int end;
+
+ IntPair(int start, int end) {
+ this.start = start;
+ this.end = end;
+ }
+
+ public int hashCode() {
+ return end + (start << 8);
+ }
+
+ public boolean equals(Object o) {
+ if ( o instanceof IntPair ) {
+ IntPair p = (IntPair) o;
+ return start == p.start && end == p.end;
+ }
+ return false;
+ }
+
+ public String toString() {
+ return "("+start+","+end+")";
+ }
+}
Index: /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/src/JFlex/Interval.java
===================================================================
--- /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/src/JFlex/Interval.java (revision 25585)
+++ /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/src/JFlex/Interval.java (revision 25585)
@@ -0,0 +1,163 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * JFlex 1.4.3 *
+ * Copyright (C) 1998-2009 Gerwin Klein *
+ * All rights reserved. *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License. See the file *
+ * COPYRIGHT for more information. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License along *
+ * with this program; if not, write to the Free Software Foundation, Inc., *
+ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *
+ * *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+package JFlex;
+
+
+/**
+ * An intervall of characters with basic operations.
+ *
+ * @author Gerwin Klein
+ * @version JFlex 1.4.3, $Revision: 433 $, $Date: 2009-01-31 19:52:34 +1100 (Sat, 31 Jan 2009) $
+ */
+public final class Interval {
+
+ /* start and end of the intervall */
+ public char start, end;
+
+
+ /**
+ * Constuct a new intervall from start
to end
.
+ *
+ * @param start first character the intervall should contain
+ * @param end last character the intervall should contain
+ */
+ public Interval(char start, char end) {
+ this.start = start;
+ this.end = end;
+ }
+
+
+ /**
+ * Copy constructor
+ */
+ public Interval(Interval other) {
+ this.start = other.start;
+ this.end = other.end;
+ }
+
+
+ /**
+ * Return true
iff point
is contained in this intervall.
+ *
+ * @param point the character to check
+ */
+ public boolean contains(char point) {
+ return start <= point && end >= point;
+ }
+
+
+ /**
+ * Return true
iff this intervall completely contains the
+ * other one.
+ *
+ * @param other the other intervall
+ */
+ public boolean contains(Interval other) {
+ return this.start <= other.start && this.end >= other.end;
+ }
+
+
+ /**
+ * Return true
if o
is an intervall
+ * with the same borders.
+ *
+ * @param o the object to check equality with
+ */
+ public boolean equals(Object o) {
+ if ( o == this ) return true;
+ if ( !(o instanceof Interval) ) return false;
+
+ Interval other = (Interval) o;
+ return other.start == this.start && other.end == this.end;
+ }
+
+
+ /**
+ * Set a new last character
+ *
+ * @param end the new last character of this intervall
+ */
+ public void setEnd(char end) {
+ this.end = end;
+ }
+
+
+ /**
+ * Set a new first character
+ *
+ * @param start the new first character of this intervall
+ */
+ public void setStart(char start) {
+ this.start = start;
+ }
+
+
+ /**
+ * Check wether a character is printable.
+ *
+ * @param c the character to check
+ */
+ private static boolean isPrintable(char c) {
+ // fixme: should make unicode test here
+ return c > 31 && c < 127;
+ }
+
+
+ /**
+ * Get a String representation of this intervall.
+ *
+ * @return a string "[start-end]"
or
+ * "[start]"
(if there is only one character in
+ * the intervall) where start
and
+ * end
are either a number (the character code)
+ * or something of the from 'a'
.
+ */
+ public String toString() {
+ StringBuffer result = new StringBuffer("[");
+
+ if ( isPrintable(start) )
+ result.append("'"+start+"'");
+ else
+ result.append( (int) start );
+
+ if (start != end) {
+ result.append("-");
+
+ if ( isPrintable(end) )
+ result.append("'"+end+"'");
+ else
+ result.append( (int) end );
+ }
+
+ result.append("]");
+ return result.toString();
+ }
+
+
+ /**
+ * Make a copy of this interval.
+ *
+ * @return the copy
+ */
+ public Interval copy() {
+ return new Interval(start,end);
+ }
+}
Index: /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/src/JFlex/LexParse.cup
===================================================================
--- /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/src/JFlex/LexParse.cup (revision 25585)
+++ /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/src/JFlex/LexParse.cup (revision 25585)
@@ -0,0 +1,648 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * JFlex 1.4.3 *
+ * Copyright (C) 1998-2009 Gerwin Klein *
+ * All rights reserved. *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License. See the file *
+ * COPYRIGHT for more information. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License along *
+ * with this program; if not, write to the Free Software Foundation, Inc., *
+ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *
+ * *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+package JFlex;
+
+import java.util.*;
+
+/* customizing code */
+
+action code {:
+
+ LexScan scanner;
+ CharClasses charClasses = new CharClasses(Options.jlex ? 127 : 0xFFFF);
+ RegExps regExps = new RegExps();
+ Macros macros = new Macros();
+ Integer stateNumber;
+ Timer t = new Timer();
+ EOFActions eofActions = new EOFActions();
+
+ void fatalError(ErrorMessages message, int line, int col) {
+ syntaxError(message, line, col);
+ throw new GeneratorException();
+ }
+
+ void fatalError(ErrorMessages message) {
+ fatalError(message, scanner.currentLine(), -1);
+ throw new GeneratorException();
+ }
+
+ void syntaxError(ErrorMessages message) {
+ Out.error(scanner.file, message, scanner.currentLine(), -1);
+ }
+
+ void syntaxError(ErrorMessages message, int line) {
+ Out.error(scanner.file, message, line, -1);
+ }
+
+ void syntaxError(ErrorMessages message, int line, int col) {
+ Out.error(scanner.file, message, line, col);
+ }
+
+
+ private boolean check(int type, char c) {
+ switch (type) {
+ case sym.JLETTERCLASS:
+ return Character.isJavaIdentifierStart(c);
+
+ case sym.JLETTERDIGITCLASS:
+ return Character.isJavaIdentifierPart(c);
+
+ case sym.LETTERCLASS:
+ return Character.isLetter(c);
+
+ case sym.DIGITCLASS:
+ return Character.isDigit(c);
+
+ case sym.UPPERCLASS:
+ return Character.isUpperCase(c);
+
+ case sym.LOWERCLASS:
+ return Character.isLowerCase(c);
+
+ default: return false;
+ }
+ }
+
+ private Vector makePreClass(int type) {
+
+ Vector result = new Vector();
+
+ char c = 0;
+ char start = 0;
+ char last = charClasses.getMaxCharCode();
+
+ boolean prev, current;
+
+ prev = check(type,'\u0000');
+
+ for (c = 1; c < last; c++) {
+
+ current = check(type,c);
+
+ if (!prev && current) start = c;
+ if (prev && !current) {
+ result.addElement(new Interval(start, (char)(c-1)));
+ }
+
+ prev = current;
+ }
+
+ // the last iteration is moved out of the loop to
+ // avoid an endless loop if last == maxCharCode and
+ // last+1 == 0
+ current = check(type,c);
+
+ if (!prev && current) result.addElement(new Interval(c,c));
+ if (prev && current) result.addElement(new Interval(start, c));
+ if (prev && !current) result.addElement(new Interval(start, (char)(c-1)));
+
+ return result;
+ }
+
+ private RegExp makeRepeat(RegExp r, int n1, int n2, int line, int col) {
+
+ if (n1 <= 0 && n2 <= 0) {
+ syntaxError(ErrorMessages.REPEAT_ZERO, line, col);
+ return null;
+ }
+
+ if (n1 > n2) {
+ syntaxError(ErrorMessages.REPEAT_GREATER, line, col);
+ return null;
+ }
+
+ int i;
+ RegExp result;
+
+ if (n1 > 0) {
+ result = r;
+ n1--; n2--; // we need one concatenation less than the number of expressions to match
+ }
+ else {
+ result = new RegExp1(sym.QUESTION,r);
+ n2--;
+ }
+
+ for (i = 0; i < n1; i++)
+ result = new RegExp2(sym.CONCAT, result, r);
+
+ n2-= n1;
+ for (i = 0; i < n2; i++)
+ result = new RegExp2(sym.CONCAT, result, new RegExp1(sym.QUESTION,r));
+
+ return result;
+ }
+
+ private RegExp makeNL() {
+ Vector list = new Vector();
+ list.addElement(new Interval('\n','\r'));
+ list.addElement(new Interval('\u0085','\u0085'));
+ list.addElement(new Interval('\u2028','\u2029'));
+
+ // assumption: line feeds are caseless
+ charClasses.makeClass(list, false);
+ charClasses.makeClass('\n', false);
+ charClasses.makeClass('\r', false);
+
+ RegExp1 c = new RegExp1(sym.CCLASS, list);
+ Character n = new Character('\n');
+ Character r = new Character('\r');
+
+ return new RegExp2(sym.BAR,
+ c,
+ new RegExp2(sym.CONCAT,
+ new RegExp1(sym.CHAR, r),
+ new RegExp1(sym.CHAR, n)));
+ }
+
+:};
+
+parser code {:
+ public LexScan scanner;
+
+ public LexParse(LexScan scanner) {
+ super(scanner);
+ this.scanner = scanner;
+ }
+
+ public CharClasses getCharClasses() {
+ return action_obj.charClasses;
+ }
+
+ public EOFActions getEOFActions() {
+ return action_obj.eofActions;
+ }
+
+ public void report_error(String message, Object info) {
+ if ( info instanceof java_cup.runtime.Symbol ) {
+ java_cup.runtime.Symbol s = (java_cup.runtime.Symbol) info;
+
+ if (s.sym == sym.EOF)
+ Out.error(ErrorMessages.UNEXPECTED_EOF);
+ else
+ Out.error(scanner.file, ErrorMessages.SYNTAX_ERROR, s.left, s.right);
+ }
+ else
+ Out.error(ErrorMessages.UNKNOWN_SYNTAX);
+ }
+
+ public void report_fatal_error(String message, Object info) {
+ // report_error(message, info);
+ throw new GeneratorException();
+ }
+
+:};
+
+init with {:
+ action_obj.scanner = this.scanner;
+:};
+
+/* token declarations */
+
+terminal OPENBRACKET, CLOSEBRACKET, HAT, DOLLAR, OPENCLASS,
+ CLOSECLASS, DASH, DELIMITER, EQUALS, COMMA, LESSTHAN,
+ MORETHAN, LBRACE, RBRACE, ASCII, FULL, UNICODE, REGEXPEND;
+
+terminal JLETTERCLASS, JLETTERDIGITCLASS, LETTERCLASS, DIGITCLASS,
+ UPPERCLASS, LOWERCLASS, EOFRULE, NOACTION, LOOKAHEAD;
+
+terminal Action ACTION;
+terminal String IDENT, USERCODE;
+terminal Integer REPEAT;
+
+/* tokens used in RegExp parse tree */
+terminal STAR, PLUS, BAR, QUESTION, POINT, BANG, TILDE;
+
+terminal Character CHAR;
+terminal String STRING, MACROUSE;
+
+/* symbols *only* used in the parse tree (not in the grammar) */
+terminal CCLASS, CCLASSNOT, CONCAT;
+terminal STRING_I, CHAR_I; /* case insensitive strings/chars */
+
+
+non terminal macros, macro;
+non terminal Integer rule;
+non terminal NFA specification;
+non terminal RegExp series, concs, nregexp, regexp, charclass, lookahead;
+non terminal Interval classcontentelem;
+non terminal Vector states, statesOPT, classcontent, preclass, rules;
+non terminal Boolean hatOPT;
+non terminal Action act, actions;
+
+
+/* grammar specification */
+start with specification;
+
+specification ::= USERCODE
+ /* delimiter is checked in lexer */
+ macros
+ DELIMITER
+ rules
+ {:
+ scanner.t.stop();
+
+ Out.checkErrors();
+
+ Out.time(ErrorMessages.PARSING_TOOK, t);
+
+ macros.expand();
+ Enumeration unused = macros.unused();
+ while ( unused.hasMoreElements() ) {
+ Out.warning("Macro \""+unused.nextElement()+"\" has been declared but never used.");
+ }
+
+ SemCheck.check(regExps, macros, scanner.file);
+
+ regExps.checkActions();
+ regExps.checkLookAheads();
+
+ Out.checkErrors();
+
+ if (Options.dump) charClasses.dump();
+
+ Out.print("Constructing NFA : ");
+
+ t.start();
+ int num = regExps.getNum();
+
+ RESULT = new NFA(charClasses.getNumClasses(),
+ scanner, regExps, macros, charClasses);
+
+ eofActions.setNumLexStates(scanner.states.number());
+
+ for (int i = 0; i < num; i++) {
+ if (regExps.isEOF(i))
+ eofActions.add( regExps.getStates(i), regExps.getAction(i) );
+ else
+ RESULT.addRegExp(i);
+ }
+
+ if (scanner.standalone) RESULT.addStandaloneRule();
+ t.stop();
+
+ Out.time("");
+ Out.time(ErrorMessages.NFA_TOOK, t);
+
+ :}
+ | /* emtpy spec. error */
+ {:
+ fatalError(ErrorMessages.NO_LEX_SPEC);
+ :}
+ ;
+
+macros ::= /* empty, most switches & state declarations are parsed in lexer */
+ | macros macro
+ | error;
+
+macro ::= ASCII
+ {: charClasses.setMaxCharCode(127); :}
+ | FULL
+ {: charClasses.setMaxCharCode(255); :}
+ | UNICODE
+ {: charClasses.setMaxCharCode(0xFFFF); :}
+ | IDENT:name EQUALS series:definition REGEXPEND
+ {: macros.insert(name, definition); :}
+ | IDENT EQUALS:e
+ {: syntaxError(ErrorMessages.REGEXP_EXPECTED, eleft, eright); :}
+ ;
+
+
+rules ::= rules:rlist rule:r
+ {: rlist.addElement(r); RESULT = rlist; :}
+ | rules:rlist1 LESSTHAN states:states MORETHAN LBRACE rules:rlist2 RBRACE
+ {:
+ Enumeration rs = rlist2.elements();
+ while ( rs.hasMoreElements() ) {
+ Integer elem = (Integer) rs.nextElement();
+ // might be null for error case of "rule"
+ if (elem != null) {
+ regExps.addStates( elem.intValue(), states );
+ }
+ rlist1.addElement( elem );
+ }
+ RESULT = rlist1;
+ :}
+ | LESSTHAN states:states MORETHAN LBRACE rules:rlist RBRACE
+ {:
+ Enumeration rs = rlist.elements();
+ while ( rs.hasMoreElements() ) {
+ Integer elem = (Integer) rs.nextElement();
+ // might be null for error case of "rule"
+ if (elem != null) {
+ regExps.addStates( elem.intValue(), states );
+ }
+ }
+ RESULT = rlist;
+ :}
+ | rule:r
+ {: RESULT = new Vector(); RESULT.addElement(r); :}
+ ;
+
+rule ::= statesOPT:s hatOPT:bol series:r actions:a
+ {: RESULT = new Integer(regExps.insert(rleft, s, r, a, bol, null)); :}
+ | statesOPT:s hatOPT:bol series:r lookahead:l act:a
+ {: RESULT = new Integer(regExps.insert(rleft, s, r, a, bol, l)); :}
+ | statesOPT:s hatOPT:bol series:r lookahead:l NOACTION:a
+ {: syntaxError(ErrorMessages.LOOKAHEAD_NEEDS_ACTION, aleft, aright+1); :}
+ | statesOPT:s EOFRULE ACTION:a
+ {: RESULT = new Integer(regExps.insert(s, a)); :}
+ | error
+ ;
+
+lookahead ::= DOLLAR
+ {: RESULT = makeNL(); :}
+ | LOOKAHEAD series:r
+ {: RESULT = r; :}
+ | LOOKAHEAD series:s DOLLAR
+ {: RESULT = new RegExp2(sym.CONCAT, s, makeNL()); :}
+ ;
+
+act ::= REGEXPEND ACTION:a
+ {: RESULT = a; :}
+ ;
+
+actions ::= act:a
+ {: RESULT = a; :}
+ | NOACTION
+ ;
+
+
+statesOPT ::= LESSTHAN states:list MORETHAN
+ {: RESULT = list; :}
+ | /* empty */
+ {: RESULT = new Vector(); :}
+ ;
+
+states ::= IDENT:id COMMA states:list
+ {:
+ stateNumber = scanner.states.getNumber( id );
+ if ( stateNumber != null )
+ list.addElement( stateNumber );
+ else {
+ throw new ScannerException(scanner.file, ErrorMessages.LEXSTATE_UNDECL,
+ idleft, idright);
+ }
+ RESULT = list;
+ :}
+ | IDENT:id
+ {:
+ Vector list = new Vector();
+ stateNumber = scanner.states.getNumber( id );
+ if ( stateNumber != null )
+ list.addElement( stateNumber );
+ else {
+ throw new ScannerException(scanner.file, ErrorMessages.LEXSTATE_UNDECL,
+ idleft, idright);
+ }
+ RESULT = list;
+ :}
+ | IDENT COMMA:c
+ {: syntaxError(ErrorMessages.REGEXP_EXPECTED, cleft, cright+1); :}
+ ;
+
+hatOPT ::= HAT
+ {: // assumption: there is no upper case for \n
+ charClasses.makeClass('\n', false);
+ RESULT = new Boolean(true); :}
+ | /* empty */
+ {: RESULT = new Boolean(false); :}
+ ;
+
+series ::= series:r1 BAR concs:r2
+ {: RESULT = new RegExp2(sym.BAR, r1, r2); :}
+ | concs:r
+ {: RESULT = r; :}
+ | BAR:b
+ {: syntaxError(ErrorMessages.REGEXP_EXPECTED, bleft, bright); :}
+ ;
+
+concs ::= concs:r1 nregexp:r2
+ {: RESULT = new RegExp2(sym.CONCAT, r1, r2); :}
+ | nregexp:r
+ {: RESULT = r; :}
+ ;
+
+nregexp ::= regexp:r
+ {: RESULT = r; :}
+ | BANG nregexp:r
+ {: RESULT = new RegExp1(sym.BANG, r); :}
+ | TILDE nregexp:r
+ {: RESULT = new RegExp1(sym.TILDE, r); :}
+ ;
+
+regexp ::= regexp:r STAR
+ {: RESULT = new RegExp1(sym.STAR, r); :}
+ | regexp:r PLUS
+ {: RESULT = new RegExp1(sym.PLUS, r); :}
+ | regexp:r QUESTION
+ {: RESULT = new RegExp1(sym.QUESTION, r); :}
+ | regexp:r REPEAT:n RBRACE:b
+ {: RESULT = makeRepeat(r, n.intValue(), n.intValue(), bleft, bright); :}
+ | regexp:r REPEAT:n1 REPEAT:n2 RBRACE
+ {: RESULT = makeRepeat(r, n1.intValue(), n2.intValue(), n1left, n2right); :}
+ | OPENBRACKET series:r CLOSEBRACKET
+ {: RESULT = r; :}
+ | MACROUSE:ident
+ {:
+ if ( !scanner.macroDefinition ) {
+ if ( ! macros.markUsed(ident) )
+ throw new ScannerException(scanner.file, ErrorMessages.MACRO_UNDECL,
+ identleft, identright);
+ }
+ RESULT = new RegExp1(sym.MACROUSE, ident);
+ :}
+ | charclass:c
+ {: RESULT = c; :}
+ | preclass:list
+ {:
+ try {
+ // assumption [correct?]: preclasses are already closed under case
+ charClasses.makeClass(list, false);
+ }
+ catch (CharClassException e) {
+ syntaxError(ErrorMessages.CHARSET_2_SMALL, listleft);
+ }
+ RESULT = new RegExp1(sym.CCLASS, list);
+ :}
+ | STRING:str
+ {:
+ try {
+ if ( scanner.caseless ) {
+ charClasses.makeClass(str, true);
+ RESULT = new RegExp1(sym.STRING_I, str);
+ }
+ else {
+ charClasses.makeClass(str, false);
+ RESULT = new RegExp1(sym.STRING, str);
+ }
+ }
+ catch (CharClassException e) {
+ syntaxError(ErrorMessages.CS2SMALL_STRING, strleft, strright);
+ }
+
+ :}
+ | POINT
+ {:
+ Vector any = new Vector();
+ any.addElement(new Interval('\n','\n'));
+ // assumption: there is no upper case for \n
+ charClasses.makeClass('\n', false);
+ RESULT = new RegExp1(sym.CCLASSNOT, any);
+ :}
+ | CHAR:c
+ {:
+ try {
+ if ( scanner.caseless ) {
+ charClasses.makeClass(c.charValue(), true);
+ RESULT = new RegExp1(sym.CHAR_I, c);
+ }
+ else {
+ charClasses.makeClass(c.charValue(), false);
+ RESULT = new RegExp1(sym.CHAR, c);
+ }
+ }
+ catch (CharClassException e) {
+ syntaxError(ErrorMessages.CS2SMALL_CHAR, cleft, cright);
+ }
+ :}
+ ;
+
+charclass ::= OPENCLASS CLOSECLASS
+ {:
+ RESULT = new RegExp1(sym.CCLASS,null);
+ :}
+ | OPENCLASS classcontent:list CLOSECLASS:close
+ {:
+ try {
+ charClasses.makeClass(list, Options.jlex && scanner.caseless);
+ }
+ catch (CharClassException e) {
+ syntaxError(ErrorMessages.CHARSET_2_SMALL, closeleft, closeright);
+ }
+ RESULT = new RegExp1(sym.CCLASS,list);
+ :}
+ | OPENCLASS HAT CLOSECLASS:close
+ {:
+ Vector list = new Vector();
+ list.addElement(new Interval((char)0,CharClasses.maxChar));
+ try {
+ charClasses.makeClass(list, false);
+ }
+ catch (CharClassException e) {
+ syntaxError(ErrorMessages.CHARSET_2_SMALL, closeleft, closeright);
+ }
+ RESULT = new RegExp1(sym.CCLASS,list);
+ :}
+ | OPENCLASS HAT classcontent:list CLOSECLASS:close
+ {:
+ try {
+ charClasses.makeClassNot(list, Options.jlex && scanner.caseless);
+ }
+ catch (CharClassException e) {
+ syntaxError(ErrorMessages.CHARSET_2_SMALL, closeleft, closeright);
+ }
+ RESULT = new RegExp1(sym.CCLASSNOT,list);
+ :}
+ | OPENCLASS DASH classcontent:list CLOSECLASS:close
+ {:
+ try {
+ list.addElement(new Interval('-','-'));
+ charClasses.makeClass(list, Options.jlex && scanner.caseless);
+ }
+ catch (CharClassException e) {
+ syntaxError(ErrorMessages.CHARSET_2_SMALL, closeleft, closeright);
+ }
+ RESULT = new RegExp1(sym.CCLASS,list);
+ :}
+ | OPENCLASS HAT DASH classcontent:list CLOSECLASS:close
+ {:
+ try {
+ list.addElement(new Interval('-','-'));
+ charClasses.makeClassNot(list, Options.jlex && scanner.caseless);
+ }
+ catch (CharClassException e) {
+ syntaxError(ErrorMessages.CHARSET_2_SMALL, closeleft, closeright);
+ }
+ RESULT = new RegExp1(sym.CCLASSNOT,list);
+ :}
+ ;
+
+classcontent ::= classcontent:list classcontentelem:elem
+ {:
+ list.addElement(elem);
+ RESULT = list;
+ :}
+ | classcontentelem:elem
+ {:
+ Vector list = new Vector();
+ list.addElement(elem);
+ RESULT = list;
+ :}
+ | classcontent:list preclass:plist
+ {:
+ for (Enumeration e = plist.elements(); e.hasMoreElements();)
+ list.addElement(e.nextElement());
+ RESULT = list;
+ :}
+ | preclass:list
+ {: RESULT = list; :}
+ | classcontent:list STRING:s
+ {:
+ for (int i = 0; i < s.length(); i++)
+ list.addElement(new Interval(s.charAt(i),s.charAt(i)));
+ RESULT = list;
+ :}
+ | STRING:s
+ {:
+ RESULT = new Vector();
+ for (int i = 0; i < s.length(); i++)
+ RESULT.addElement(new Interval(s.charAt(i),s.charAt(i)));
+ :}
+ | classcontent:list MACROUSE:ident
+ {:
+ syntaxError(ErrorMessages.CHARCLASS_MACRO, identleft, identright);
+ :}
+ | MACROUSE:ident
+ {:
+ syntaxError(ErrorMessages.CHARCLASS_MACRO, identleft, identright);
+ :}
+ ;
+
+classcontentelem ::= CHAR:c1 DASH CHAR:c2
+ {: RESULT = new Interval(c1.charValue(), c2.charValue()); :}
+ | CHAR:c
+ {: RESULT = new Interval(c.charValue(), c.charValue()); :}
+ ;
+
+preclass ::= JLETTERCLASS
+ {: RESULT = makePreClass(sym.JLETTERCLASS); :}
+ | JLETTERDIGITCLASS
+ {: RESULT = makePreClass(sym.JLETTERDIGITCLASS); :}
+ | LETTERCLASS
+ {: RESULT = makePreClass(sym.LETTERCLASS); :}
+ | DIGITCLASS
+ {: RESULT = makePreClass(sym.DIGITCLASS); :}
+ | UPPERCLASS
+ {: RESULT = makePreClass(sym.UPPERCLASS); :}
+ | LOWERCLASS
+ {: RESULT = makePreClass(sym.LOWERCLASS); :}
+ ;
Index: /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/src/JFlex/LexParse.java
===================================================================
--- /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/src/JFlex/LexParse.java (revision 25585)
+++ /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/src/JFlex/LexParse.java (revision 25585)
@@ -0,0 +1,1794 @@
+
+//----------------------------------------------------
+// The following code was generated by CUP v0.11a beta 20060608
+// Sat Jan 31 23:52:43 EST 2009
+//----------------------------------------------------
+
+package JFlex;
+
+import java.util.*;
+
+/** CUP v0.11a beta 20060608 generated parser.
+ * @version Sat Jan 31 23:52:43 EST 2009
+ */
+public class LexParse extends java_cup.runtime.lr_parser {
+
+ /** Default constructor. */
+ public LexParse() {super();}
+
+ /** Constructor which sets the default scanner. */
+ public LexParse(java_cup.runtime.Scanner s) {super(s);}
+
+ /** Constructor which sets the default scanner. */
+ public LexParse(java_cup.runtime.Scanner s, java_cup.runtime.SymbolFactory sf) {super(s,sf);}
+
+ /** Production table. */
+ protected static final short _production_table[][] =
+ unpackFromStrings(new String[] {
+ "\000\113\000\002\002\004\000\002\005\006\000\002\005" +
+ "\002\000\002\002\002\000\002\002\004\000\002\002\003" +
+ "\000\002\003\003\000\002\003\003\000\002\003\003\000" +
+ "\002\003\006\000\002\003\004\000\002\021\004\000\002" +
+ "\021\011\000\002\021\010\000\002\021\003\000\002\004" +
+ "\006\000\002\004\007\000\002\004\007\000\002\004\005" +
+ "\000\002\004\003\000\002\013\003\000\002\013\004\000" +
+ "\002\013\005\000\002\023\004\000\002\024\003\000\002" +
+ "\024\003\000\002\016\005\000\002\016\002\000\002\015" +
+ "\005\000\002\015\003\000\002\015\004\000\002\022\003" +
+ "\000\002\022\002\000\002\006\005\000\002\006\003\000" +
+ "\002\006\003\000\002\007\004\000\002\007\003\000\002" +
+ "\010\003\000\002\010\004\000\002\010\004\000\002\011" +
+ "\004\000\002\011\004\000\002\011\004\000\002\011\005" +
+ "\000\002\011\006\000\002\011\005\000\002\011\003\000" +
+ "\002\011\003\000\002\011\003\000\002\011\003\000\002" +
+ "\011\003\000\002\011\003\000\002\012\004\000\002\012" +
+ "\005\000\002\012\005\000\002\012\006\000\002\012\006" +
+ "\000\002\012\007\000\002\017\004\000\002\017\003\000" +
+ "\002\017\004\000\002\017\003\000\002\017\004\000\002" +
+ "\017\003\000\002\017\004\000\002\017\003\000\002\014" +
+ "\005\000\002\014\003\000\002\020\003\000\002\020\003" +
+ "\000\002\020\003\000\002\020\003\000\002\020\003\000" +
+ "\002\020\003" });
+
+ /** Access to production table. */
+ public short[][] production_table() {return _production_table;}
+
+ /** Parse-action table. */
+ protected static final short[][] _action_table =
+ unpackFromStrings(new String[] {
+ "\000\156\000\006\002\uffff\041\004\001\002\000\016\003" +
+ "\007\013\ufffe\022\ufffe\023\ufffe\024\ufffe\040\ufffe\001\002" +
+ "\000\004\002\006\001\002\000\004\002\001\001\002\000" +
+ "\014\013\ufffc\022\ufffc\023\ufffc\024\ufffc\040\ufffc\001\002" +
+ "\000\014\013\012\022\011\023\016\024\015\040\014\001" +
+ "\002\000\014\013\ufffb\022\ufffb\023\ufffb\024\ufffb\040\ufffb" +
+ "\001\002\000\050\003\114\004\uffe6\006\uffe6\010\uffe6\016" +
+ "\116\026\uffe6\027\uffe6\030\uffe6\031\uffe6\032\uffe6\033\uffe6" +
+ "\034\uffe6\045\uffe6\047\uffe6\050\uffe6\051\uffe6\052\uffe6\053" +
+ "\uffe6\054\uffe6\001\002\000\014\013\ufffd\022\ufffd\023\ufffd" +
+ "\024\ufffd\040\ufffd\001\002\000\004\014\017\001\002\000" +
+ "\014\013\ufff9\022\ufff9\023\ufff9\024\ufff9\040\ufff9\001\002" +
+ "\000\014\013\ufffa\022\ufffa\023\ufffa\024\ufffa\040\ufffa\001" +
+ "\002\000\052\004\034\010\044\013\ufff7\022\ufff7\023\ufff7" +
+ "\024\ufff7\026\023\027\031\030\020\031\042\032\035\033" +
+ "\032\040\ufff7\045\041\047\022\050\037\051\024\052\021" +
+ "\053\030\054\025\001\002\000\064\004\uffba\005\uffba\007" +
+ "\uffba\010\uffba\011\uffba\025\uffba\026\uffba\027\uffba\030\uffba" +
+ "\031\uffba\032\uffba\033\uffba\035\uffba\036\uffba\042\uffba\043" +
+ "\uffba\044\uffba\045\uffba\046\uffba\047\uffba\050\uffba\051\uffba" +
+ "\052\uffba\053\uffba\054\uffba\001\002\000\062\004\uffcd\005" +
+ "\uffcd\007\uffcd\010\uffcd\025\uffcd\026\uffcd\027\uffcd\030\uffcd" +
+ "\031\uffcd\032\uffcd\033\uffcd\035\uffcd\036\uffcd\042\uffcd\043" +
+ "\uffcd\044\uffcd\045\uffcd\046\uffcd\047\uffcd\050\uffcd\051\uffcd" +
+ "\052\uffcd\053\uffcd\054\uffcd\001\002\000\062\004\uffce\005" +
+ "\uffce\007\uffce\010\uffce\025\uffce\026\uffce\027\uffce\030\uffce" +
+ "\031\uffce\032\uffce\033\uffce\035\uffce\036\uffce\042\uffce\043" +
+ "\uffce\044\uffce\045\uffce\046\uffce\047\uffce\050\uffce\051\uffce" +
+ "\052\uffce\053\uffce\054\uffce\001\002\000\064\004\uffbc\005" +
+ "\uffbc\007\uffbc\010\uffbc\011\uffbc\025\uffbc\026\uffbc\027\uffbc" +
+ "\030\uffbc\031\uffbc\032\uffbc\033\uffbc\035\uffbc\036\uffbc\042" +
+ "\uffbc\043\uffbc\044\uffbc\045\uffbc\046\uffbc\047\uffbc\050\uffbc" +
+ "\051\uffbc\052\uffbc\053\uffbc\054\uffbc\001\002\000\036\004" +
+ "\034\010\044\026\023\027\031\030\020\031\042\032\035" +
+ "\033\032\047\022\050\037\051\024\052\021\053\030\054" +
+ "\025\001\002\000\062\004\uffd2\005\uffd2\007\uffd2\010\uffd2" +
+ "\025\uffd2\026\uffd2\027\uffd2\030\uffd2\031\uffd2\032\uffd2\033" +
+ "\uffd2\035\uffd2\036\uffd2\042\uffd2\043\uffd2\044\uffd2\045\uffd2" +
+ "\046\uffd2\047\uffd2\050\uffd2\051\uffd2\052\uffd2\053\uffd2\054" +
+ "\uffd2\001\002\000\006\025\112\045\106\001\002\000\062" +
+ "\004\uffd0\005\uffd0\007\uffd0\010\uffd0\025\uffd0\026\uffd0\027" +
+ "\uffd0\030\uffd0\031\uffd0\032\uffd0\033\uffd0\035\uffd0\036\uffd0" +
+ "\042\uffd0\043\uffd0\044\uffd0\045\uffd0\046\uffd0\047\uffd0\050" +
+ "\uffd0\051\uffd0\052\uffd0\053\uffd0\054\uffd0\001\002\000\062" +
+ "\004\uffcf\005\uffcf\007\uffcf\010\uffcf\025\uffcf\026\uffcf\027" +
+ "\uffcf\030\uffcf\031\uffcf\032\uffcf\033\uffcf\035\uffcf\036\uffcf" +
+ "\042\uffcf\043\uffcf\044\uffcf\045\uffcf\046\uffcf\047\uffcf\050" +
+ "\uffcf\051\uffcf\052\uffcf\053\uffcf\054\uffcf\001\002\000\064" +
+ "\004\uffbb\005\uffbb\007\uffbb\010\uffbb\011\uffbb\025\uffbb\026" +
+ "\uffbb\027\uffbb\030\uffbb\031\uffbb\032\uffbb\033\uffbb\035\uffbb" +
+ "\036\uffbb\042\uffbb\043\uffbb\044\uffbb\045\uffbb\046\uffbb\047" +
+ "\uffbb\050\uffbb\051\uffbb\052\uffbb\053\uffbb\054\uffbb\001\002" +
+ "\000\064\004\uffb7\005\uffb7\007\uffb7\010\uffb7\011\uffb7\025" +
+ "\uffb7\026\uffb7\027\uffb7\030\uffb7\031\uffb7\032\uffb7\033\uffb7" +
+ "\035\uffb7\036\uffb7\042\uffb7\043\uffb7\044\uffb7\045\uffb7\046" +
+ "\uffb7\047\uffb7\050\uffb7\051\uffb7\052\uffb7\053\uffb7\054\uffb7" +
+ "\001\002\000\052\004\034\005\uffdf\007\uffdf\010\044\025" +
+ "\uffdf\026\023\027\031\030\020\031\042\032\035\033\032" +
+ "\035\uffdf\036\uffdf\045\uffdf\047\022\050\037\051\024\052" +
+ "\021\053\030\054\025\001\002\000\040\004\034\010\044" +
+ "\026\023\027\031\030\020\031\042\032\035\033\032\045" +
+ "\041\047\022\050\037\051\024\052\021\053\030\054\025" +
+ "\001\002\000\064\004\uffb8\005\uffb8\007\uffb8\010\uffb8\011" +
+ "\uffb8\025\uffb8\026\uffb8\027\uffb8\030\uffb8\031\uffb8\032\uffb8" +
+ "\033\uffb8\035\uffb8\036\uffb8\042\uffb8\043\uffb8\044\uffb8\045" +
+ "\uffb8\046\uffb8\047\uffb8\050\uffb8\051\uffb8\052\uffb8\053\uffb8" +
+ "\054\uffb8\001\002\000\062\004\uffd1\005\uffd1\007\uffd1\010" +
+ "\uffd1\025\uffd1\026\uffd1\027\uffd1\030\uffd1\031\uffd1\032\uffd1" +
+ "\033\uffd1\035\uffd1\036\uffd1\042\uffd1\043\uffd1\044\uffd1\045" +
+ "\uffd1\046\uffd1\047\uffd1\050\uffd1\051\uffd1\052\uffd1\053\uffd1" +
+ "\054\uffd1\001\002\000\036\004\034\010\044\026\023\027" +
+ "\031\030\020\031\042\032\035\033\032\047\022\050\037" +
+ "\051\024\052\021\053\030\054\025\001\002\000\052\004" +
+ "\uffdc\005\uffdc\007\uffdc\010\uffdc\025\uffdc\026\uffdc\027\uffdc" +
+ "\030\uffdc\031\uffdc\032\uffdc\033\uffdc\035\uffdc\036\uffdc\045" +
+ "\uffdc\047\uffdc\050\uffdc\051\uffdc\052\uffdc\053\uffdc\054\uffdc" +
+ "\001\002\000\016\005\uffde\007\uffde\025\uffde\035\uffde\036" +
+ "\uffde\045\uffde\001\002\000\064\004\uffb9\005\uffb9\007\uffb9" +
+ "\010\uffb9\011\uffb9\025\uffb9\026\uffb9\027\uffb9\030\uffb9\031" +
+ "\uffb9\032\uffb9\033\uffb9\035\uffb9\036\uffb9\042\uffb9\043\uffb9" +
+ "\044\uffb9\045\uffb9\046\uffb9\047\uffb9\050\uffb9\051\uffb9\052" +
+ "\uffb9\053\uffb9\054\uffb9\001\002\000\062\004\uffdb\005\uffdb" +
+ "\007\uffdb\010\uffdb\025\uffdb\026\uffdb\027\uffdb\030\uffdb\031" +
+ "\uffdb\032\uffdb\033\uffdb\035\uffdb\036\uffdb\042\077\043\075" +
+ "\044\076\045\uffdb\046\100\047\uffdb\050\uffdb\051\uffdb\052" +
+ "\uffdb\053\uffdb\054\uffdb\001\002\000\032\006\047\011\051" +
+ "\012\050\026\023\027\031\030\020\031\042\032\035\033" +
+ "\032\052\055\053\052\054\053\001\002\000\026\011\uffc3" +
+ "\026\uffc3\027\uffc3\030\uffc3\031\uffc3\032\uffc3\033\uffc3\052" +
+ "\uffc3\053\uffc3\054\uffc3\001\002\000\026\011\uffc5\026\uffc5" +
+ "\027\uffc5\030\uffc5\031\uffc5\032\uffc5\033\uffc5\052\uffc5\053" +
+ "\uffc5\054\uffc5\001\002\000\030\011\070\012\067\026\023" +
+ "\027\031\030\020\031\042\032\035\033\032\052\055\053" +
+ "\052\054\053\001\002\000\024\026\023\027\031\030\020" +
+ "\031\042\032\035\033\032\052\055\053\052\054\053\001" +
+ "\002\000\062\004\uffcc\005\uffcc\007\uffcc\010\uffcc\025\uffcc" +
+ "\026\uffcc\027\uffcc\030\uffcc\031\uffcc\032\uffcc\033\uffcc\035" +
+ "\uffcc\036\uffcc\042\uffcc\043\uffcc\044\uffcc\045\uffcc\046\uffcc" +
+ "\047\uffcc\050\uffcc\051\uffcc\052\uffcc\053\uffcc\054\uffcc\001" +
+ "\002\000\026\011\uffc1\026\uffc1\027\uffc1\030\uffc1\031\uffc1" +
+ "\032\uffc1\033\uffc1\052\uffc1\053\uffc1\054\uffc1\001\002\000" +
+ "\026\011\uffbf\026\uffbf\027\uffbf\030\uffbf\031\uffbf\032\uffbf" +
+ "\033\uffbf\052\uffbf\053\uffbf\054\uffbf\001\002\000\026\011" +
+ "\062\026\023\027\031\030\020\031\042\032\035\033\032" +
+ "\052\055\053\063\054\064\001\002\000\030\011\uffbd\012" +
+ "\056\026\uffbd\027\uffbd\030\uffbd\031\uffbd\032\uffbd\033\uffbd" +
+ "\052\uffbd\053\uffbd\054\uffbd\001\002\000\004\052\057\001" +
+ "\002\000\026\011\uffbe\026\uffbe\027\uffbe\030\uffbe\031\uffbe" +
+ "\032\uffbe\033\uffbe\052\uffbe\053\uffbe\054\uffbe\001\002\000" +
+ "\026\011\uffc4\026\uffc4\027\uffc4\030\uffc4\031\uffc4\032\uffc4" +
+ "\033\uffc4\052\uffc4\053\uffc4\054\uffc4\001\002\000\026\011" +
+ "\uffc6\026\uffc6\027\uffc6\030\uffc6\031\uffc6\032\uffc6\033\uffc6" +
+ "\052\uffc6\053\uffc6\054\uffc6\001\002\000\062\004\uffcb\005" +
+ "\uffcb\007\uffcb\010\uffcb\025\uffcb\026\uffcb\027\uffcb\030\uffcb" +
+ "\031\uffcb\032\uffcb\033\uffcb\035\uffcb\036\uffcb\042\uffcb\043" +
+ "\uffcb\044\uffcb\045\uffcb\046\uffcb\047\uffcb\050\uffcb\051\uffcb" +
+ "\052\uffcb\053\uffcb\054\uffcb\001\002\000\026\011\uffc2\026" +
+ "\uffc2\027\uffc2\030\uffc2\031\uffc2\032\uffc2\033\uffc2\052\uffc2" +
+ "\053\uffc2\054\uffc2\001\002\000\026\011\uffc0\026\uffc0\027" +
+ "\uffc0\030\uffc0\031\uffc0\032\uffc0\033\uffc0\052\uffc0\053\uffc0" +
+ "\054\uffc0\001\002\000\026\011\066\026\023\027\031\030" +
+ "\020\031\042\032\035\033\032\052\055\053\063\054\064" +
+ "\001\002\000\062\004\uffc8\005\uffc8\007\uffc8\010\uffc8\025" +
+ "\uffc8\026\uffc8\027\uffc8\030\uffc8\031\uffc8\032\uffc8\033\uffc8" +
+ "\035\uffc8\036\uffc8\042\uffc8\043\uffc8\044\uffc8\045\uffc8\046" +
+ "\uffc8\047\uffc8\050\uffc8\051\uffc8\052\uffc8\053\uffc8\054\uffc8" +
+ "\001\002\000\024\026\023\027\031\030\020\031\042\032" +
+ "\035\033\032\052\055\053\052\054\053\001\002\000\062" +
+ "\004\uffca\005\uffca\007\uffca\010\uffca\025\uffca\026\uffca\027" +
+ "\uffca\030\uffca\031\uffca\032\uffca\033\uffca\035\uffca\036\uffca" +
+ "\042\uffca\043\uffca\044\uffca\045\uffca\046\uffca\047\uffca\050" +
+ "\uffca\051\uffca\052\uffca\053\uffca\054\uffca\001\002\000\026" +
+ "\011\072\026\023\027\031\030\020\031\042\032\035\033" +
+ "\032\052\055\053\063\054\064\001\002\000\062\004\uffc9" +
+ "\005\uffc9\007\uffc9\010\uffc9\025\uffc9\026\uffc9\027\uffc9\030" +
+ "\uffc9\031\uffc9\032\uffc9\033\uffc9\035\uffc9\036\uffc9\042\uffc9" +
+ "\043\uffc9\044\uffc9\045\uffc9\046\uffc9\047\uffc9\050\uffc9\051" +
+ "\uffc9\052\uffc9\053\uffc9\054\uffc9\001\002\000\026\011\074" +
+ "\026\023\027\031\030\020\031\042\032\035\033\032\052" +
+ "\055\053\063\054\064\001\002\000\062\004\uffc7\005\uffc7" +
+ "\007\uffc7\010\uffc7\025\uffc7\026\uffc7\027\uffc7\030\uffc7\031" +
+ "\uffc7\032\uffc7\033\uffc7\035\uffc7\036\uffc7\042\uffc7\043\uffc7" +
+ "\044\uffc7\045\uffc7\046\uffc7\047\uffc7\050\uffc7\051\uffc7\052" +
+ "\uffc7\053\uffc7\054\uffc7\001\002\000\062\004\uffd8\005\uffd8" +
+ "\007\uffd8\010\uffd8\025\uffd8\026\uffd8\027\uffd8\030\uffd8\031" +
+ "\uffd8\032\uffd8\033\uffd8\035\uffd8\036\uffd8\042\uffd8\043\uffd8" +
+ "\044\uffd8\045\uffd8\046\uffd8\047\uffd8\050\uffd8\051\uffd8\052" +
+ "\uffd8\053\uffd8\054\uffd8\001\002\000\062\004\uffd7\005\uffd7" +
+ "\007\uffd7\010\uffd7\025\uffd7\026\uffd7\027\uffd7\030\uffd7\031" +
+ "\uffd7\032\uffd7\033\uffd7\035\uffd7\036\uffd7\042\uffd7\043\uffd7" +
+ "\044\uffd7\045\uffd7\046\uffd7\047\uffd7\050\uffd7\051\uffd7\052" +
+ "\uffd7\053\uffd7\054\uffd7\001\002\000\006\021\101\042\102" +
+ "\001\002\000\062\004\uffd6\005\uffd6\007\uffd6\010\uffd6\025" +
+ "\uffd6\026\uffd6\027\uffd6\030\uffd6\031\uffd6\032\uffd6\033\uffd6" +
+ "\035\uffd6\036\uffd6\042\uffd6\043\uffd6\044\uffd6\045\uffd6\046" +
+ "\uffd6\047\uffd6\050\uffd6\051\uffd6\052\uffd6\053\uffd6\054\uffd6" +
+ "\001\002\000\062\004\uffd5\005\uffd5\007\uffd5\010\uffd5\025" +
+ "\uffd5\026\uffd5\027\uffd5\030\uffd5\031\uffd5\032\uffd5\033\uffd5" +
+ "\035\uffd5\036\uffd5\042\uffd5\043\uffd5\044\uffd5\045\uffd5\046" +
+ "\uffd5\047\uffd5\050\uffd5\051\uffd5\052\uffd5\053\uffd5\054\uffd5" +
+ "\001\002\000\004\021\103\001\002\000\062\004\uffd4\005" +
+ "\uffd4\007\uffd4\010\uffd4\025\uffd4\026\uffd4\027\uffd4\030\uffd4" +
+ "\031\uffd4\032\uffd4\033\uffd4\035\uffd4\036\uffd4\042\uffd4\043" +
+ "\uffd4\044\uffd4\045\uffd4\046\uffd4\047\uffd4\050\uffd4\051\uffd4" +
+ "\052\uffd4\053\uffd4\054\uffd4\001\002\000\052\004\uffda\005" +
+ "\uffda\007\uffda\010\uffda\025\uffda\026\uffda\027\uffda\030\uffda" +
+ "\031\uffda\032\uffda\033\uffda\035\uffda\036\uffda\045\uffda\047" +
+ "\uffda\050\uffda\051\uffda\052\uffda\053\uffda\054\uffda\001\002" +
+ "\000\006\005\107\045\106\001\002\000\036\004\034\010" +
+ "\044\026\023\027\031\030\020\031\042\032\035\033\032" +
+ "\047\022\050\037\051\024\052\021\053\030\054\025\001" +
+ "\002\000\062\004\uffd3\005\uffd3\007\uffd3\010\uffd3\025\uffd3" +
+ "\026\uffd3\027\uffd3\030\uffd3\031\uffd3\032\uffd3\033\uffd3\035" +
+ "\uffd3\036\uffd3\042\uffd3\043\uffd3\044\uffd3\045\uffd3\046\uffd3" +
+ "\047\uffd3\050\uffd3\051\uffd3\052\uffd3\053\uffd3\054\uffd3\001" +
+ "\002\000\052\004\034\005\uffe0\007\uffe0\010\044\025\uffe0" +
+ "\026\023\027\031\030\020\031\042\032\035\033\032\035" +
+ "\uffe0\036\uffe0\045\uffe0\047\022\050\037\051\024\052\021" +
+ "\053\030\054\025\001\002\000\052\004\uffdd\005\uffdd\007" +
+ "\uffdd\010\uffdd\025\uffdd\026\uffdd\027\uffdd\030\uffdd\031\uffdd" +
+ "\032\uffdd\033\uffdd\035\uffdd\036\uffdd\045\uffdd\047\uffdd\050" +
+ "\uffdd\051\uffdd\052\uffdd\053\uffdd\054\uffdd\001\002\000\014" +
+ "\013\ufff8\022\ufff8\023\ufff8\024\ufff8\040\ufff8\001\002\000" +
+ "\052\004\uffd9\005\uffd9\007\uffd9\010\uffd9\025\uffd9\026\uffd9" +
+ "\027\uffd9\030\uffd9\031\uffd9\032\uffd9\033\uffd9\035\uffd9\036" +
+ "\uffd9\045\uffd9\047\uffd9\050\uffd9\051\uffd9\052\uffd9\053\uffd9" +
+ "\054\uffd9\001\002\000\054\002\uffee\003\uffee\004\uffee\006" +
+ "\uffee\010\uffee\016\uffee\021\uffee\026\uffee\027\uffee\030\uffee" +
+ "\031\uffee\032\uffee\033\uffee\034\uffee\045\uffee\047\uffee\050" +
+ "\uffee\051\uffee\052\uffee\053\uffee\054\uffee\001\002\000\044" +
+ "\004\uffe1\006\142\010\uffe1\026\uffe1\027\uffe1\030\uffe1\031" +
+ "\uffe1\032\uffe1\033\uffe1\034\140\045\uffe1\047\uffe1\050\uffe1" +
+ "\051\uffe1\052\uffe1\053\uffe1\054\uffe1\001\002\000\004\040" +
+ "\124\001\002\000\054\002\ufff3\003\ufff3\004\ufff3\006\ufff3" +
+ "\010\ufff3\016\ufff3\021\ufff3\026\ufff3\027\ufff3\030\ufff3\031" +
+ "\ufff3\032\ufff3\033\ufff3\034\ufff3\045\ufff3\047\ufff3\050\ufff3" +
+ "\051\ufff3\052\ufff3\053\ufff3\054\ufff3\001\002\000\052\002" +
+ "\000\003\114\004\uffe6\006\uffe6\010\uffe6\016\121\026\uffe6" +
+ "\027\uffe6\030\uffe6\031\uffe6\032\uffe6\033\uffe6\034\uffe6\045" +
+ "\uffe6\047\uffe6\050\uffe6\051\uffe6\052\uffe6\053\uffe6\054\uffe6" +
+ "\001\002\000\004\040\124\001\002\000\054\002\ufff6\003" +
+ "\ufff6\004\ufff6\006\ufff6\010\ufff6\016\ufff6\021\ufff6\026\ufff6" +
+ "\027\ufff6\030\ufff6\031\ufff6\032\ufff6\033\ufff6\034\ufff6\045" +
+ "\ufff6\047\ufff6\050\ufff6\051\ufff6\052\ufff6\053\ufff6\054\ufff6" +
+ "\001\002\000\004\017\127\001\002\000\006\015\125\017" +
+ "\uffe4\001\002\000\006\017\uffe3\040\124\001\002\000\004" +
+ "\017\uffe5\001\002\000\046\004\uffe7\006\uffe7\010\uffe7\020" +
+ "\130\026\uffe7\027\uffe7\030\uffe7\031\uffe7\032\uffe7\033\uffe7" +
+ "\034\uffe7\045\uffe7\047\uffe7\050\uffe7\051\uffe7\052\uffe7\053" +
+ "\uffe7\054\uffe7\001\002\000\050\003\114\004\uffe6\006\uffe6" +
+ "\010\uffe6\016\116\026\uffe6\027\uffe6\030\uffe6\031\uffe6\032" +
+ "\uffe6\033\uffe6\034\uffe6\045\uffe6\047\uffe6\050\uffe6\051\uffe6" +
+ "\052\uffe6\053\uffe6\054\uffe6\001\002\000\052\003\114\004" +
+ "\uffe6\006\uffe6\010\uffe6\016\121\021\132\026\uffe6\027\uffe6" +
+ "\030\uffe6\031\uffe6\032\uffe6\033\uffe6\034\uffe6\045\uffe6\047" +
+ "\uffe6\050\uffe6\051\uffe6\052\uffe6\053\uffe6\054\uffe6\001\002" +
+ "\000\054\002\ufff5\003\ufff5\004\ufff5\006\ufff5\010\ufff5\016" +
+ "\ufff5\021\ufff5\026\ufff5\027\ufff5\030\ufff5\031\ufff5\032\ufff5" +
+ "\033\ufff5\034\ufff5\045\ufff5\047\ufff5\050\ufff5\051\ufff5\052" +
+ "\ufff5\053\ufff5\054\ufff5\001\002\000\004\017\134\001\002" +
+ "\000\046\004\uffe7\006\uffe7\010\uffe7\020\135\026\uffe7\027" +
+ "\uffe7\030\uffe7\031\uffe7\032\uffe7\033\uffe7\034\uffe7\045\uffe7" +
+ "\047\uffe7\050\uffe7\051\uffe7\052\uffe7\053\uffe7\054\uffe7\001" +
+ "\002\000\050\003\114\004\uffe6\006\uffe6\010\uffe6\016\116" +
+ "\026\uffe6\027\uffe6\030\uffe6\031\uffe6\032\uffe6\033\uffe6\034" +
+ "\uffe6\045\uffe6\047\uffe6\050\uffe6\051\uffe6\052\uffe6\053\uffe6" +
+ "\054\uffe6\001\002\000\052\003\114\004\uffe6\006\uffe6\010" +
+ "\uffe6\016\121\021\137\026\uffe6\027\uffe6\030\uffe6\031\uffe6" +
+ "\032\uffe6\033\uffe6\034\uffe6\045\uffe6\047\uffe6\050\uffe6\051" +
+ "\uffe6\052\uffe6\053\uffe6\054\uffe6\001\002\000\054\002\ufff4" +
+ "\003\ufff4\004\ufff4\006\ufff4\010\ufff4\016\ufff4\021\ufff4\026" +
+ "\ufff4\027\ufff4\030\ufff4\031\ufff4\032\ufff4\033\ufff4\034\ufff4" +
+ "\045\ufff4\047\ufff4\050\ufff4\051\ufff4\052\ufff4\053\ufff4\054" +
+ "\ufff4\001\002\000\004\037\160\001\002\000\040\004\034" +
+ "\010\044\026\023\027\031\030\020\031\042\032\035\033" +
+ "\032\045\041\047\022\050\037\051\024\052\021\053\030" +
+ "\054\025\001\002\000\040\004\uffe2\010\uffe2\026\uffe2\027" +
+ "\uffe2\030\uffe2\031\uffe2\032\uffe2\033\uffe2\045\uffe2\047\uffe2" +
+ "\050\uffe2\051\uffe2\052\uffe2\053\uffe2\054\uffe2\001\002\000" +
+ "\014\007\152\025\147\035\144\036\146\045\106\001\002" +
+ "\000\054\002\uffe8\003\uffe8\004\uffe8\006\uffe8\010\uffe8\016" +
+ "\uffe8\021\uffe8\026\uffe8\027\uffe8\030\uffe8\031\uffe8\032\uffe8" +
+ "\033\uffe8\034\uffe8\045\uffe8\047\uffe8\050\uffe8\051\uffe8\052" +
+ "\uffe8\053\uffe8\054\uffe8\001\002\000\054\002\uffe9\003\uffe9" +
+ "\004\uffe9\006\uffe9\010\uffe9\016\uffe9\021\uffe9\026\uffe9\027" +
+ "\uffe9\030\uffe9\031\uffe9\032\uffe9\033\uffe9\034\uffe9\045\uffe9" +
+ "\047\uffe9\050\uffe9\051\uffe9\052\uffe9\053\uffe9\054\uffe9\001" +
+ "\002\000\040\004\034\010\044\026\023\027\031\030\020" +
+ "\031\042\032\035\033\032\045\041\047\022\050\037\051" +
+ "\024\052\021\053\030\054\025\001\002\000\004\037\155" +
+ "\001\002\000\006\025\147\035\153\001\002\000\054\002" +
+ "\ufff2\003\ufff2\004\ufff2\006\ufff2\010\ufff2\016\ufff2\021\ufff2" +
+ "\026\ufff2\027\ufff2\030\ufff2\031\ufff2\032\ufff2\033\ufff2\034" +
+ "\ufff2\045\ufff2\047\ufff2\050\ufff2\051\ufff2\052\ufff2\053\ufff2" +
+ "\054\ufff2\001\002\000\006\025\uffed\035\uffed\001\002\000" +
+ "\054\002\ufff0\003\ufff0\004\ufff0\006\ufff0\010\ufff0\016\ufff0" +
+ "\021\ufff0\026\ufff0\027\ufff0\030\ufff0\031\ufff0\032\ufff0\033" +
+ "\ufff0\034\ufff0\045\ufff0\047\ufff0\050\ufff0\051\ufff0\052\ufff0" +
+ "\053\ufff0\054\ufff0\001\002\000\054\002\ufff1\003\ufff1\004" +
+ "\ufff1\006\ufff1\010\ufff1\016\ufff1\021\ufff1\026\ufff1\027\ufff1" +
+ "\030\ufff1\031\ufff1\032\ufff1\033\ufff1\034\ufff1\045\ufff1\047" +
+ "\ufff1\050\ufff1\051\ufff1\052\ufff1\053\ufff1\054\ufff1\001\002" +
+ "\000\054\002\uffea\003\uffea\004\uffea\006\uffea\010\uffea\016" +
+ "\uffea\021\uffea\026\uffea\027\uffea\030\uffea\031\uffea\032\uffea" +
+ "\033\uffea\034\uffea\045\uffea\047\uffea\050\uffea\051\uffea\052" +
+ "\uffea\053\uffea\054\uffea\001\002\000\012\007\157\025\uffec" +
+ "\035\uffec\045\106\001\002\000\006\025\uffeb\035\uffeb\001" +
+ "\002\000\054\002\uffef\003\uffef\004\uffef\006\uffef\010\uffef" +
+ "\016\uffef\021\uffef\026\uffef\027\uffef\030\uffef\031\uffef\032" +
+ "\uffef\033\uffef\034\uffef\045\uffef\047\uffef\050\uffef\051\uffef" +
+ "\052\uffef\053\uffef\054\uffef\001\002" });
+
+ /** Access to parse-action table. */
+ public short[][] action_table() {return _action_table;}
+
+ /** reduce_goto
table. */
+ protected static final short[][] _reduce_table =
+ unpackFromStrings(new String[] {
+ "\000\156\000\004\005\004\001\001\000\004\002\007\001" +
+ "\001\000\002\001\001\000\002\001\001\000\002\001\001" +
+ "\000\004\003\012\001\001\000\002\001\001\000\010\004" +
+ "\116\016\114\021\117\001\001\000\002\001\001\000\002" +
+ "\001\001\000\002\001\001\000\002\001\001\000\016\006" +
+ "\025\007\032\010\037\011\042\012\035\020\026\001\001" +
+ "\000\002\001\001\000\002\001\001\000\002\001\001\000" +
+ "\002\001\001\000\012\010\112\011\042\012\035\020\026" +
+ "\001\001\000\002\001\001\000\002\001\001\000\002\001" +
+ "\001\000\002\001\001\000\002\001\001\000\002\001\001" +
+ "\000\012\010\110\011\042\012\035\020\026\001\001\000" +
+ "\016\006\104\007\032\010\037\011\042\012\035\020\026" +
+ "\001\001\000\002\001\001\000\002\001\001\000\012\010" +
+ "\103\011\042\012\035\020\026\001\001\000\002\001\001" +
+ "\000\002\001\001\000\002\001\001\000\002\001\001\000" +
+ "\010\014\045\017\053\020\044\001\001\000\002\001\001" +
+ "\000\002\001\001\000\010\014\045\017\070\020\044\001" +
+ "\001\000\010\014\045\017\064\020\044\001\001\000\002" +
+ "\001\001\000\002\001\001\000\002\001\001\000\006\014" +
+ "\060\020\057\001\001\000\002\001\001\000\002\001\001" +
+ "\000\002\001\001\000\002\001\001\000\002\001\001\000" +
+ "\002\001\001\000\002\001\001\000\002\001\001\000\006" +
+ "\014\060\020\057\001\001\000\002\001\001\000\010\014" +
+ "\045\017\072\020\044\001\001\000\002\001\001\000\006" +
+ "\014\060\020\057\001\001\000\002\001\001\000\006\014" +
+ "\060\020\057\001\001\000\002\001\001\000\002\001\001" +
+ "\000\002\001\001\000\002\001\001\000\002\001\001\000" +
+ "\002\001\001\000\002\001\001\000\002\001\001\000\002" +
+ "\001\001\000\002\001\001\000\014\007\107\010\037\011" +
+ "\042\012\035\020\026\001\001\000\002\001\001\000\012" +
+ "\010\110\011\042\012\035\020\026\001\001\000\002\001" +
+ "\001\000\002\001\001\000\002\001\001\000\002\001\001" +
+ "\000\004\022\140\001\001\000\004\015\132\001\001\000" +
+ "\002\001\001\000\006\004\121\016\114\001\001\000\004" +
+ "\015\122\001\001\000\002\001\001\000\002\001\001\000" +
+ "\002\001\001\000\004\015\125\001\001\000\002\001\001" +
+ "\000\002\001\001\000\010\004\116\016\114\021\130\001" +
+ "\001\000\006\004\121\016\114\001\001\000\002\001\001" +
+ "\000\002\001\001\000\002\001\001\000\010\004\116\016" +
+ "\114\021\135\001\001\000\006\004\121\016\114\001\001" +
+ "\000\002\001\001\000\002\001\001\000\016\006\142\007" +
+ "\032\010\037\011\042\012\035\020\026\001\001\000\002" +
+ "\001\001\000\010\013\147\023\144\024\150\001\001\000" +
+ "\002\001\001\000\002\001\001\000\016\006\155\007\032" +
+ "\010\037\011\042\012\035\020\026\001\001\000\002\001" +
+ "\001\000\004\023\153\001\001\000\002\001\001\000\002" +
+ "\001\001\000\002\001\001\000\002\001\001\000\002\001" +
+ "\001\000\002\001\001\000\002\001\001\000\002\001\001" +
+ "" });
+
+ /** Access to reduce_goto
table. */
+ public short[][] reduce_table() {return _reduce_table;}
+
+ /** Instance of action encapsulation class. */
+ protected CUP$LexParse$actions action_obj;
+
+ /** Action encapsulation object initializer. */
+ protected void init_actions()
+ {
+ action_obj = new CUP$LexParse$actions(this);
+ }
+
+ /** Invoke a user supplied parse action. */
+ public java_cup.runtime.Symbol do_action(
+ int act_num,
+ java_cup.runtime.lr_parser parser,
+ java.util.Stack stack,
+ int top)
+ throws java.lang.Exception
+ {
+ /* call code in generated class */
+ return action_obj.CUP$LexParse$do_action(act_num, parser, stack, top);
+ }
+
+ /** Indicates start state. */
+ public int start_state() {return 0;}
+ /** Indicates start production. */
+ public int start_production() {return 0;}
+
+ /** EOF
Symbol index. */
+ public int EOF_sym() {return 0;}
+
+ /** error
Symbol index. */
+ public int error_sym() {return 1;}
+
+
+ /** User initialization code. */
+ public void user_init() throws java.lang.Exception
+ {
+
+ action_obj.scanner = this.scanner;
+
+ }
+
+
+ public LexScan scanner;
+
+ public LexParse(LexScan scanner) {
+ super(scanner);
+ this.scanner = scanner;
+ }
+
+ public CharClasses getCharClasses() {
+ return action_obj.charClasses;
+ }
+
+ public EOFActions getEOFActions() {
+ return action_obj.eofActions;
+ }
+
+ public void report_error(String message, Object info) {
+ if ( info instanceof java_cup.runtime.Symbol ) {
+ java_cup.runtime.Symbol s = (java_cup.runtime.Symbol) info;
+
+ if (s.sym == sym.EOF)
+ Out.error(ErrorMessages.UNEXPECTED_EOF);
+ else
+ Out.error(scanner.file, ErrorMessages.SYNTAX_ERROR, s.left, s.right);
+ }
+ else
+ Out.error(ErrorMessages.UNKNOWN_SYNTAX);
+ }
+
+ public void report_fatal_error(String message, Object info) {
+ // report_error(message, info);
+ throw new GeneratorException();
+ }
+
+
+}
+
+/** Cup generated class to encapsulate user supplied action code.*/
+class CUP$LexParse$actions {
+
+
+
+ LexScan scanner;
+ CharClasses charClasses = new CharClasses(Options.jlex ? 127 : 0xFFFF);
+ RegExps regExps = new RegExps();
+ Macros macros = new Macros();
+ Integer stateNumber;
+ Timer t = new Timer();
+ EOFActions eofActions = new EOFActions();
+
+ void fatalError(ErrorMessages message, int line, int col) {
+ syntaxError(message, line, col);
+ throw new GeneratorException();
+ }
+
+ void fatalError(ErrorMessages message) {
+ fatalError(message, scanner.currentLine(), -1);
+ throw new GeneratorException();
+ }
+
+ void syntaxError(ErrorMessages message) {
+ Out.error(scanner.file, message, scanner.currentLine(), -1);
+ }
+
+ void syntaxError(ErrorMessages message, int line) {
+ Out.error(scanner.file, message, line, -1);
+ }
+
+ void syntaxError(ErrorMessages message, int line, int col) {
+ Out.error(scanner.file, message, line, col);
+ }
+
+
+ private boolean check(int type, char c) {
+ switch (type) {
+ case sym.JLETTERCLASS:
+ return Character.isJavaIdentifierStart(c);
+
+ case sym.JLETTERDIGITCLASS:
+ return Character.isJavaIdentifierPart(c);
+
+ case sym.LETTERCLASS:
+ return Character.isLetter(c);
+
+ case sym.DIGITCLASS:
+ return Character.isDigit(c);
+
+ case sym.UPPERCLASS:
+ return Character.isUpperCase(c);
+
+ case sym.LOWERCLASS:
+ return Character.isLowerCase(c);
+
+ default: return false;
+ }
+ }
+
+ private Vector makePreClass(int type) {
+
+ Vector result = new Vector();
+
+ char c = 0;
+ char start = 0;
+ char last = charClasses.getMaxCharCode();
+
+ boolean prev, current;
+
+ prev = check(type,'\u0000');
+
+ for (c = 1; c < last; c++) {
+
+ current = check(type,c);
+
+ if (!prev && current) start = c;
+ if (prev && !current) {
+ result.addElement(new Interval(start, (char)(c-1)));
+ }
+
+ prev = current;
+ }
+
+ // the last iteration is moved out of the loop to
+ // avoid an endless loop if last == maxCharCode and
+ // last+1 == 0
+ current = check(type,c);
+
+ if (!prev && current) result.addElement(new Interval(c,c));
+ if (prev && current) result.addElement(new Interval(start, c));
+ if (prev && !current) result.addElement(new Interval(start, (char)(c-1)));
+
+ return result;
+ }
+
+ private RegExp makeRepeat(RegExp r, int n1, int n2, int line, int col) {
+
+ if (n1 <= 0 && n2 <= 0) {
+ syntaxError(ErrorMessages.REPEAT_ZERO, line, col);
+ return null;
+ }
+
+ if (n1 > n2) {
+ syntaxError(ErrorMessages.REPEAT_GREATER, line, col);
+ return null;
+ }
+
+ int i;
+ RegExp result;
+
+ if (n1 > 0) {
+ result = r;
+ n1--; n2--; // we need one concatenation less than the number of expressions to match
+ }
+ else {
+ result = new RegExp1(sym.QUESTION,r);
+ n2--;
+ }
+
+ for (i = 0; i < n1; i++)
+ result = new RegExp2(sym.CONCAT, result, r);
+
+ n2-= n1;
+ for (i = 0; i < n2; i++)
+ result = new RegExp2(sym.CONCAT, result, new RegExp1(sym.QUESTION,r));
+
+ return result;
+ }
+
+ private RegExp makeNL() {
+ Vector list = new Vector();
+ list.addElement(new Interval('\n','\r'));
+ list.addElement(new Interval('\u0085','\u0085'));
+ list.addElement(new Interval('\u2028','\u2029'));
+
+ // assumption: line feeds are caseless
+ charClasses.makeClass(list, false);
+ charClasses.makeClass('\n', false);
+ charClasses.makeClass('\r', false);
+
+ RegExp1 c = new RegExp1(sym.CCLASS, list);
+ Character n = new Character('\n');
+ Character r = new Character('\r');
+
+ return new RegExp2(sym.BAR,
+ c,
+ new RegExp2(sym.CONCAT,
+ new RegExp1(sym.CHAR, r),
+ new RegExp1(sym.CHAR, n)));
+ }
+
+
+ private final LexParse parser;
+
+ /** Constructor */
+ CUP$LexParse$actions(LexParse parser) {
+ this.parser = parser;
+ }
+
+ /** Method with the actual generated action code. */
+ public final java_cup.runtime.Symbol CUP$LexParse$do_action(
+ int CUP$LexParse$act_num,
+ java_cup.runtime.lr_parser CUP$LexParse$parser,
+ java.util.Stack CUP$LexParse$stack,
+ int CUP$LexParse$top)
+ throws java.lang.Exception
+ {
+ /* Symbol object for return from actions */
+ java_cup.runtime.Symbol CUP$LexParse$result;
+
+ /* select the action based on the action number */
+ switch (CUP$LexParse$act_num)
+ {
+ /*. . . . . . . . . . . . . . . . . . . .*/
+ case 74: // preclass ::= LOWERCLASS
+ {
+ Vector RESULT =null;
+ RESULT = makePreClass(sym.LOWERCLASS);
+ CUP$LexParse$result = parser.getSymbolFactory().newSymbol("preclass",14, ((java_cup.runtime.Symbol)CUP$LexParse$stack.peek()), ((java_cup.runtime.Symbol)CUP$LexParse$stack.peek()), RESULT);
+ }
+ return CUP$LexParse$result;
+
+ /*. . . . . . . . . . . . . . . . . . . .*/
+ case 73: // preclass ::= UPPERCLASS
+ {
+ Vector RESULT =null;
+ RESULT = makePreClass(sym.UPPERCLASS);
+ CUP$LexParse$result = parser.getSymbolFactory().newSymbol("preclass",14, ((java_cup.runtime.Symbol)CUP$LexParse$stack.peek()), ((java_cup.runtime.Symbol)CUP$LexParse$stack.peek()), RESULT);
+ }
+ return CUP$LexParse$result;
+
+ /*. . . . . . . . . . . . . . . . . . . .*/
+ case 72: // preclass ::= DIGITCLASS
+ {
+ Vector RESULT =null;
+ RESULT = makePreClass(sym.DIGITCLASS);
+ CUP$LexParse$result = parser.getSymbolFactory().newSymbol("preclass",14, ((java_cup.runtime.Symbol)CUP$LexParse$stack.peek()), ((java_cup.runtime.Symbol)CUP$LexParse$stack.peek()), RESULT);
+ }
+ return CUP$LexParse$result;
+
+ /*. . . . . . . . . . . . . . . . . . . .*/
+ case 71: // preclass ::= LETTERCLASS
+ {
+ Vector RESULT =null;
+ RESULT = makePreClass(sym.LETTERCLASS);
+ CUP$LexParse$result = parser.getSymbolFactory().newSymbol("preclass",14, ((java_cup.runtime.Symbol)CUP$LexParse$stack.peek()), ((java_cup.runtime.Symbol)CUP$LexParse$stack.peek()), RESULT);
+ }
+ return CUP$LexParse$result;
+
+ /*. . . . . . . . . . . . . . . . . . . .*/
+ case 70: // preclass ::= JLETTERDIGITCLASS
+ {
+ Vector RESULT =null;
+ RESULT = makePreClass(sym.JLETTERDIGITCLASS);
+ CUP$LexParse$result = parser.getSymbolFactory().newSymbol("preclass",14, ((java_cup.runtime.Symbol)CUP$LexParse$stack.peek()), ((java_cup.runtime.Symbol)CUP$LexParse$stack.peek()), RESULT);
+ }
+ return CUP$LexParse$result;
+
+ /*. . . . . . . . . . . . . . . . . . . .*/
+ case 69: // preclass ::= JLETTERCLASS
+ {
+ Vector RESULT =null;
+ RESULT = makePreClass(sym.JLETTERCLASS);
+ CUP$LexParse$result = parser.getSymbolFactory().newSymbol("preclass",14, ((java_cup.runtime.Symbol)CUP$LexParse$stack.peek()), ((java_cup.runtime.Symbol)CUP$LexParse$stack.peek()), RESULT);
+ }
+ return CUP$LexParse$result;
+
+ /*. . . . . . . . . . . . . . . . . . . .*/
+ case 68: // classcontentelem ::= CHAR
+ {
+ Interval RESULT =null;
+ int cleft = ((java_cup.runtime.Symbol)CUP$LexParse$stack.peek()).left;
+ int cright = ((java_cup.runtime.Symbol)CUP$LexParse$stack.peek()).right;
+ Character c = (Character)((java_cup.runtime.Symbol) CUP$LexParse$stack.peek()).value;
+ RESULT = new Interval(c.charValue(), c.charValue());
+ CUP$LexParse$result = parser.getSymbolFactory().newSymbol("classcontentelem",10, ((java_cup.runtime.Symbol)CUP$LexParse$stack.peek()), ((java_cup.runtime.Symbol)CUP$LexParse$stack.peek()), RESULT);
+ }
+ return CUP$LexParse$result;
+
+ /*. . . . . . . . . . . . . . . . . . . .*/
+ case 67: // classcontentelem ::= CHAR DASH CHAR
+ {
+ Interval RESULT =null;
+ int c1left = ((java_cup.runtime.Symbol)CUP$LexParse$stack.elementAt(CUP$LexParse$top-2)).left;
+ int c1right = ((java_cup.runtime.Symbol)CUP$LexParse$stack.elementAt(CUP$LexParse$top-2)).right;
+ Character c1 = (Character)((java_cup.runtime.Symbol) CUP$LexParse$stack.elementAt(CUP$LexParse$top-2)).value;
+ int c2left = ((java_cup.runtime.Symbol)CUP$LexParse$stack.peek()).left;
+ int c2right = ((java_cup.runtime.Symbol)CUP$LexParse$stack.peek()).right;
+ Character c2 = (Character)((java_cup.runtime.Symbol) CUP$LexParse$stack.peek()).value;
+ RESULT = new Interval(c1.charValue(), c2.charValue());
+ CUP$LexParse$result = parser.getSymbolFactory().newSymbol("classcontentelem",10, ((java_cup.runtime.Symbol)CUP$LexParse$stack.elementAt(CUP$LexParse$top-2)), ((java_cup.runtime.Symbol)CUP$LexParse$stack.peek()), RESULT);
+ }
+ return CUP$LexParse$result;
+
+ /*. . . . . . . . . . . . . . . . . . . .*/
+ case 66: // classcontent ::= MACROUSE
+ {
+ Vector RESULT =null;
+ int identleft = ((java_cup.runtime.Symbol)CUP$LexParse$stack.peek()).left;
+ int identright = ((java_cup.runtime.Symbol)CUP$LexParse$stack.peek()).right;
+ String ident = (String)((java_cup.runtime.Symbol) CUP$LexParse$stack.peek()).value;
+
+ syntaxError(ErrorMessages.CHARCLASS_MACRO, identleft, identright);
+
+ CUP$LexParse$result = parser.getSymbolFactory().newSymbol("classcontent",13, ((java_cup.runtime.Symbol)CUP$LexParse$stack.peek()), ((java_cup.runtime.Symbol)CUP$LexParse$stack.peek()), RESULT);
+ }
+ return CUP$LexParse$result;
+
+ /*. . . . . . . . . . . . . . . . . . . .*/
+ case 65: // classcontent ::= classcontent MACROUSE
+ {
+ Vector RESULT =null;
+ int listleft = ((java_cup.runtime.Symbol)CUP$LexParse$stack.elementAt(CUP$LexParse$top-1)).left;
+ int listright = ((java_cup.runtime.Symbol)CUP$LexParse$stack.elementAt(CUP$LexParse$top-1)).right;
+ Vector list = (Vector)((java_cup.runtime.Symbol) CUP$LexParse$stack.elementAt(CUP$LexParse$top-1)).value;
+ int identleft = ((java_cup.runtime.Symbol)CUP$LexParse$stack.peek()).left;
+ int identright = ((java_cup.runtime.Symbol)CUP$LexParse$stack.peek()).right;
+ String ident = (String)((java_cup.runtime.Symbol) CUP$LexParse$stack.peek()).value;
+
+ syntaxError(ErrorMessages.CHARCLASS_MACRO, identleft, identright);
+
+ CUP$LexParse$result = parser.getSymbolFactory().newSymbol("classcontent",13, ((java_cup.runtime.Symbol)CUP$LexParse$stack.elementAt(CUP$LexParse$top-1)), ((java_cup.runtime.Symbol)CUP$LexParse$stack.peek()), RESULT);
+ }
+ return CUP$LexParse$result;
+
+ /*. . . . . . . . . . . . . . . . . . . .*/
+ case 64: // classcontent ::= STRING
+ {
+ Vector RESULT =null;
+ int sleft = ((java_cup.runtime.Symbol)CUP$LexParse$stack.peek()).left;
+ int sright = ((java_cup.runtime.Symbol)CUP$LexParse$stack.peek()).right;
+ String s = (String)((java_cup.runtime.Symbol) CUP$LexParse$stack.peek()).value;
+
+ RESULT = new Vector();
+ for (int i = 0; i < s.length(); i++)
+ RESULT.addElement(new Interval(s.charAt(i),s.charAt(i)));
+
+ CUP$LexParse$result = parser.getSymbolFactory().newSymbol("classcontent",13, ((java_cup.runtime.Symbol)CUP$LexParse$stack.peek()), ((java_cup.runtime.Symbol)CUP$LexParse$stack.peek()), RESULT);
+ }
+ return CUP$LexParse$result;
+
+ /*. . . . . . . . . . . . . . . . . . . .*/
+ case 63: // classcontent ::= classcontent STRING
+ {
+ Vector RESULT =null;
+ int listleft = ((java_cup.runtime.Symbol)CUP$LexParse$stack.elementAt(CUP$LexParse$top-1)).left;
+ int listright = ((java_cup.runtime.Symbol)CUP$LexParse$stack.elementAt(CUP$LexParse$top-1)).right;
+ Vector list = (Vector)((java_cup.runtime.Symbol) CUP$LexParse$stack.elementAt(CUP$LexParse$top-1)).value;
+ int sleft = ((java_cup.runtime.Symbol)CUP$LexParse$stack.peek()).left;
+ int sright = ((java_cup.runtime.Symbol)CUP$LexParse$stack.peek()).right;
+ String s = (String)((java_cup.runtime.Symbol) CUP$LexParse$stack.peek()).value;
+
+ for (int i = 0; i < s.length(); i++)
+ list.addElement(new Interval(s.charAt(i),s.charAt(i)));
+ RESULT = list;
+
+ CUP$LexParse$result = parser.getSymbolFactory().newSymbol("classcontent",13, ((java_cup.runtime.Symbol)CUP$LexParse$stack.elementAt(CUP$LexParse$top-1)), ((java_cup.runtime.Symbol)CUP$LexParse$stack.peek()), RESULT);
+ }
+ return CUP$LexParse$result;
+
+ /*. . . . . . . . . . . . . . . . . . . .*/
+ case 62: // classcontent ::= preclass
+ {
+ Vector RESULT =null;
+ int listleft = ((java_cup.runtime.Symbol)CUP$LexParse$stack.peek()).left;
+ int listright = ((java_cup.runtime.Symbol)CUP$LexParse$stack.peek()).right;
+ Vector list = (Vector)((java_cup.runtime.Symbol) CUP$LexParse$stack.peek()).value;
+ RESULT = list;
+ CUP$LexParse$result = parser.getSymbolFactory().newSymbol("classcontent",13, ((java_cup.runtime.Symbol)CUP$LexParse$stack.peek()), ((java_cup.runtime.Symbol)CUP$LexParse$stack.peek()), RESULT);
+ }
+ return CUP$LexParse$result;
+
+ /*. . . . . . . . . . . . . . . . . . . .*/
+ case 61: // classcontent ::= classcontent preclass
+ {
+ Vector RESULT =null;
+ int listleft = ((java_cup.runtime.Symbol)CUP$LexParse$stack.elementAt(CUP$LexParse$top-1)).left;
+ int listright = ((java_cup.runtime.Symbol)CUP$LexParse$stack.elementAt(CUP$LexParse$top-1)).right;
+ Vector list = (Vector)((java_cup.runtime.Symbol) CUP$LexParse$stack.elementAt(CUP$LexParse$top-1)).value;
+ int plistleft = ((java_cup.runtime.Symbol)CUP$LexParse$stack.peek()).left;
+ int plistright = ((java_cup.runtime.Symbol)CUP$LexParse$stack.peek()).right;
+ Vector plist = (Vector)((java_cup.runtime.Symbol) CUP$LexParse$stack.peek()).value;
+
+ for (Enumeration e = plist.elements(); e.hasMoreElements();)
+ list.addElement(e.nextElement());
+ RESULT = list;
+
+ CUP$LexParse$result = parser.getSymbolFactory().newSymbol("classcontent",13, ((java_cup.runtime.Symbol)CUP$LexParse$stack.elementAt(CUP$LexParse$top-1)), ((java_cup.runtime.Symbol)CUP$LexParse$stack.peek()), RESULT);
+ }
+ return CUP$LexParse$result;
+
+ /*. . . . . . . . . . . . . . . . . . . .*/
+ case 60: // classcontent ::= classcontentelem
+ {
+ Vector RESULT =null;
+ int elemleft = ((java_cup.runtime.Symbol)CUP$LexParse$stack.peek()).left;
+ int elemright = ((java_cup.runtime.Symbol)CUP$LexParse$stack.peek()).right;
+ Interval elem = (Interval)((java_cup.runtime.Symbol) CUP$LexParse$stack.peek()).value;
+
+ Vector list = new Vector();
+ list.addElement(elem);
+ RESULT = list;
+
+ CUP$LexParse$result = parser.getSymbolFactory().newSymbol("classcontent",13, ((java_cup.runtime.Symbol)CUP$LexParse$stack.peek()), ((java_cup.runtime.Symbol)CUP$LexParse$stack.peek()), RESULT);
+ }
+ return CUP$LexParse$result;
+
+ /*. . . . . . . . . . . . . . . . . . . .*/
+ case 59: // classcontent ::= classcontent classcontentelem
+ {
+ Vector RESULT =null;
+ int listleft = ((java_cup.runtime.Symbol)CUP$LexParse$stack.elementAt(CUP$LexParse$top-1)).left;
+ int listright = ((java_cup.runtime.Symbol)CUP$LexParse$stack.elementAt(CUP$LexParse$top-1)).right;
+ Vector list = (Vector)((java_cup.runtime.Symbol) CUP$LexParse$stack.elementAt(CUP$LexParse$top-1)).value;
+ int elemleft = ((java_cup.runtime.Symbol)CUP$LexParse$stack.peek()).left;
+ int elemright = ((java_cup.runtime.Symbol)CUP$LexParse$stack.peek()).right;
+ Interval elem = (Interval)((java_cup.runtime.Symbol) CUP$LexParse$stack.peek()).value;
+
+ list.addElement(elem);
+ RESULT = list;
+
+ CUP$LexParse$result = parser.getSymbolFactory().newSymbol("classcontent",13, ((java_cup.runtime.Symbol)CUP$LexParse$stack.elementAt(CUP$LexParse$top-1)), ((java_cup.runtime.Symbol)CUP$LexParse$stack.peek()), RESULT);
+ }
+ return CUP$LexParse$result;
+
+ /*. . . . . . . . . . . . . . . . . . . .*/
+ case 58: // charclass ::= OPENCLASS HAT DASH classcontent CLOSECLASS
+ {
+ RegExp RESULT =null;
+ int listleft = ((java_cup.runtime.Symbol)CUP$LexParse$stack.elementAt(CUP$LexParse$top-1)).left;
+ int listright = ((java_cup.runtime.Symbol)CUP$LexParse$stack.elementAt(CUP$LexParse$top-1)).right;
+ Vector list = (Vector)((java_cup.runtime.Symbol) CUP$LexParse$stack.elementAt(CUP$LexParse$top-1)).value;
+ int closeleft = ((java_cup.runtime.Symbol)CUP$LexParse$stack.peek()).left;
+ int closeright = ((java_cup.runtime.Symbol)CUP$LexParse$stack.peek()).right;
+ Object close = (Object)((java_cup.runtime.Symbol) CUP$LexParse$stack.peek()).value;
+
+ try {
+ list.addElement(new Interval('-','-'));
+ charClasses.makeClassNot(list, Options.jlex && scanner.caseless);
+ }
+ catch (CharClassException e) {
+ syntaxError(ErrorMessages.CHARSET_2_SMALL, closeleft, closeright);
+ }
+ RESULT = new RegExp1(sym.CCLASSNOT,list);
+
+ CUP$LexParse$result = parser.getSymbolFactory().newSymbol("charclass",8, ((java_cup.runtime.Symbol)CUP$LexParse$stack.elementAt(CUP$LexParse$top-4)), ((java_cup.runtime.Symbol)CUP$LexParse$stack.peek()), RESULT);
+ }
+ return CUP$LexParse$result;
+
+ /*. . . . . . . . . . . . . . . . . . . .*/
+ case 57: // charclass ::= OPENCLASS DASH classcontent CLOSECLASS
+ {
+ RegExp RESULT =null;
+ int listleft = ((java_cup.runtime.Symbol)CUP$LexParse$stack.elementAt(CUP$LexParse$top-1)).left;
+ int listright = ((java_cup.runtime.Symbol)CUP$LexParse$stack.elementAt(CUP$LexParse$top-1)).right;
+ Vector list = (Vector)((java_cup.runtime.Symbol) CUP$LexParse$stack.elementAt(CUP$LexParse$top-1)).value;
+ int closeleft = ((java_cup.runtime.Symbol)CUP$LexParse$stack.peek()).left;
+ int closeright = ((java_cup.runtime.Symbol)CUP$LexParse$stack.peek()).right;
+ Object close = (Object)((java_cup.runtime.Symbol) CUP$LexParse$stack.peek()).value;
+
+ try {
+ list.addElement(new Interval('-','-'));
+ charClasses.makeClass(list, Options.jlex && scanner.caseless);
+ }
+ catch (CharClassException e) {
+ syntaxError(ErrorMessages.CHARSET_2_SMALL, closeleft, closeright);
+ }
+ RESULT = new RegExp1(sym.CCLASS,list);
+
+ CUP$LexParse$result = parser.getSymbolFactory().newSymbol("charclass",8, ((java_cup.runtime.Symbol)CUP$LexParse$stack.elementAt(CUP$LexParse$top-3)), ((java_cup.runtime.Symbol)CUP$LexParse$stack.peek()), RESULT);
+ }
+ return CUP$LexParse$result;
+
+ /*. . . . . . . . . . . . . . . . . . . .*/
+ case 56: // charclass ::= OPENCLASS HAT classcontent CLOSECLASS
+ {
+ RegExp RESULT =null;
+ int listleft = ((java_cup.runtime.Symbol)CUP$LexParse$stack.elementAt(CUP$LexParse$top-1)).left;
+ int listright = ((java_cup.runtime.Symbol)CUP$LexParse$stack.elementAt(CUP$LexParse$top-1)).right;
+ Vector list = (Vector)((java_cup.runtime.Symbol) CUP$LexParse$stack.elementAt(CUP$LexParse$top-1)).value;
+ int closeleft = ((java_cup.runtime.Symbol)CUP$LexParse$stack.peek()).left;
+ int closeright = ((java_cup.runtime.Symbol)CUP$LexParse$stack.peek()).right;
+ Object close = (Object)((java_cup.runtime.Symbol) CUP$LexParse$stack.peek()).value;
+
+ try {
+ charClasses.makeClassNot(list, Options.jlex && scanner.caseless);
+ }
+ catch (CharClassException e) {
+ syntaxError(ErrorMessages.CHARSET_2_SMALL, closeleft, closeright);
+ }
+ RESULT = new RegExp1(sym.CCLASSNOT,list);
+
+ CUP$LexParse$result = parser.getSymbolFactory().newSymbol("charclass",8, ((java_cup.runtime.Symbol)CUP$LexParse$stack.elementAt(CUP$LexParse$top-3)), ((java_cup.runtime.Symbol)CUP$LexParse$stack.peek()), RESULT);
+ }
+ return CUP$LexParse$result;
+
+ /*. . . . . . . . . . . . . . . . . . . .*/
+ case 55: // charclass ::= OPENCLASS HAT CLOSECLASS
+ {
+ RegExp RESULT =null;
+ int closeleft = ((java_cup.runtime.Symbol)CUP$LexParse$stack.peek()).left;
+ int closeright = ((java_cup.runtime.Symbol)CUP$LexParse$stack.peek()).right;
+ Object close = (Object)((java_cup.runtime.Symbol) CUP$LexParse$stack.peek()).value;
+
+ Vector list = new Vector();
+ list.addElement(new Interval((char)0,CharClasses.maxChar));
+ try {
+ charClasses.makeClass(list, false);
+ }
+ catch (CharClassException e) {
+ syntaxError(ErrorMessages.CHARSET_2_SMALL, closeleft, closeright);
+ }
+ RESULT = new RegExp1(sym.CCLASS,list);
+
+ CUP$LexParse$result = parser.getSymbolFactory().newSymbol("charclass",8, ((java_cup.runtime.Symbol)CUP$LexParse$stack.elementAt(CUP$LexParse$top-2)), ((java_cup.runtime.Symbol)CUP$LexParse$stack.peek()), RESULT);
+ }
+ return CUP$LexParse$result;
+
+ /*. . . . . . . . . . . . . . . . . . . .*/
+ case 54: // charclass ::= OPENCLASS classcontent CLOSECLASS
+ {
+ RegExp RESULT =null;
+ int listleft = ((java_cup.runtime.Symbol)CUP$LexParse$stack.elementAt(CUP$LexParse$top-1)).left;
+ int listright = ((java_cup.runtime.Symbol)CUP$LexParse$stack.elementAt(CUP$LexParse$top-1)).right;
+ Vector list = (Vector)((java_cup.runtime.Symbol) CUP$LexParse$stack.elementAt(CUP$LexParse$top-1)).value;
+ int closeleft = ((java_cup.runtime.Symbol)CUP$LexParse$stack.peek()).left;
+ int closeright = ((java_cup.runtime.Symbol)CUP$LexParse$stack.peek()).right;
+ Object close = (Object)((java_cup.runtime.Symbol) CUP$LexParse$stack.peek()).value;
+
+ try {
+ charClasses.makeClass(list, Options.jlex && scanner.caseless);
+ }
+ catch (CharClassException e) {
+ syntaxError(ErrorMessages.CHARSET_2_SMALL, closeleft, closeright);
+ }
+ RESULT = new RegExp1(sym.CCLASS,list);
+
+ CUP$LexParse$result = parser.getSymbolFactory().newSymbol("charclass",8, ((java_cup.runtime.Symbol)CUP$LexParse$stack.elementAt(CUP$LexParse$top-2)), ((java_cup.runtime.Symbol)CUP$LexParse$stack.peek()), RESULT);
+ }
+ return CUP$LexParse$result;
+
+ /*. . . . . . . . . . . . . . . . . . . .*/
+ case 53: // charclass ::= OPENCLASS CLOSECLASS
+ {
+ RegExp RESULT =null;
+
+ RESULT = new RegExp1(sym.CCLASS,null);
+
+ CUP$LexParse$result = parser.getSymbolFactory().newSymbol("charclass",8, ((java_cup.runtime.Symbol)CUP$LexParse$stack.elementAt(CUP$LexParse$top-1)), ((java_cup.runtime.Symbol)CUP$LexParse$stack.peek()), RESULT);
+ }
+ return CUP$LexParse$result;
+
+ /*. . . . . . . . . . . . . . . . . . . .*/
+ case 52: // regexp ::= CHAR
+ {
+ RegExp RESULT =null;
+ int cleft = ((java_cup.runtime.Symbol)CUP$LexParse$stack.peek()).left;
+ int cright = ((java_cup.runtime.Symbol)CUP$LexParse$stack.peek()).right;
+ Character c = (Character)((java_cup.runtime.Symbol) CUP$LexParse$stack.peek()).value;
+
+ try {
+ if ( scanner.caseless ) {
+ charClasses.makeClass(c.charValue(), true);
+ RESULT = new RegExp1(sym.CHAR_I, c);
+ }
+ else {
+ charClasses.makeClass(c.charValue(), false);
+ RESULT = new RegExp1(sym.CHAR, c);
+ }
+ }
+ catch (CharClassException e) {
+ syntaxError(ErrorMessages.CS2SMALL_CHAR, cleft, cright);
+ }
+
+ CUP$LexParse$result = parser.getSymbolFactory().newSymbol("regexp",7, ((java_cup.runtime.Symbol)CUP$LexParse$stack.peek()), ((java_cup.runtime.Symbol)CUP$LexParse$stack.peek()), RESULT);
+ }
+ return CUP$LexParse$result;
+
+ /*. . . . . . . . . . . . . . . . . . . .*/
+ case 51: // regexp ::= POINT
+ {
+ RegExp RESULT =null;
+
+ Vector any = new Vector();
+ any.addElement(new Interval('\n','\n'));
+ // assumption: there is no upper case for \n
+ charClasses.makeClass('\n', false);
+ RESULT = new RegExp1(sym.CCLASSNOT, any);
+
+ CUP$LexParse$result = parser.getSymbolFactory().newSymbol("regexp",7, ((java_cup.runtime.Symbol)CUP$LexParse$stack.peek()), ((java_cup.runtime.Symbol)CUP$LexParse$stack.peek()), RESULT);
+ }
+ return CUP$LexParse$result;
+
+ /*. . . . . . . . . . . . . . . . . . . .*/
+ case 50: // regexp ::= STRING
+ {
+ RegExp RESULT =null;
+ int strleft = ((java_cup.runtime.Symbol)CUP$LexParse$stack.peek()).left;
+ int strright = ((java_cup.runtime.Symbol)CUP$LexParse$stack.peek()).right;
+ String str = (String)((java_cup.runtime.Symbol) CUP$LexParse$stack.peek()).value;
+
+ try {
+ if ( scanner.caseless ) {
+ charClasses.makeClass(str, true);
+ RESULT = new RegExp1(sym.STRING_I, str);
+ }
+ else {
+ charClasses.makeClass(str, false);
+ RESULT = new RegExp1(sym.STRING, str);
+ }
+ }
+ catch (CharClassException e) {
+ syntaxError(ErrorMessages.CS2SMALL_STRING, strleft, strright);
+ }
+
+
+ CUP$LexParse$result = parser.getSymbolFactory().newSymbol("regexp",7, ((java_cup.runtime.Symbol)CUP$LexParse$stack.peek()), ((java_cup.runtime.Symbol)CUP$LexParse$stack.peek()), RESULT);
+ }
+ return CUP$LexParse$result;
+
+ /*. . . . . . . . . . . . . . . . . . . .*/
+ case 49: // regexp ::= preclass
+ {
+ RegExp RESULT =null;
+ int listleft = ((java_cup.runtime.Symbol)CUP$LexParse$stack.peek()).left;
+ int listright = ((java_cup.runtime.Symbol)CUP$LexParse$stack.peek()).right;
+ Vector list = (Vector)((java_cup.runtime.Symbol) CUP$LexParse$stack.peek()).value;
+
+ try {
+ // assumption [correct?]: preclasses are already closed under case
+ charClasses.makeClass(list, false);
+ }
+ catch (CharClassException e) {
+ syntaxError(ErrorMessages.CHARSET_2_SMALL, listleft);
+ }
+ RESULT = new RegExp1(sym.CCLASS, list);
+
+ CUP$LexParse$result = parser.getSymbolFactory().newSymbol("regexp",7, ((java_cup.runtime.Symbol)CUP$LexParse$stack.peek()), ((java_cup.runtime.Symbol)CUP$LexParse$stack.peek()), RESULT);
+ }
+ return CUP$LexParse$result;
+
+ /*. . . . . . . . . . . . . . . . . . . .*/
+ case 48: // regexp ::= charclass
+ {
+ RegExp RESULT =null;
+ int cleft = ((java_cup.runtime.Symbol)CUP$LexParse$stack.peek()).left;
+ int cright = ((java_cup.runtime.Symbol)CUP$LexParse$stack.peek()).right;
+ RegExp c = (RegExp)((java_cup.runtime.Symbol) CUP$LexParse$stack.peek()).value;
+ RESULT = c;
+ CUP$LexParse$result = parser.getSymbolFactory().newSymbol("regexp",7, ((java_cup.runtime.Symbol)CUP$LexParse$stack.peek()), ((java_cup.runtime.Symbol)CUP$LexParse$stack.peek()), RESULT);
+ }
+ return CUP$LexParse$result;
+
+ /*. . . . . . . . . . . . . . . . . . . .*/
+ case 47: // regexp ::= MACROUSE
+ {
+ RegExp RESULT =null;
+ int identleft = ((java_cup.runtime.Symbol)CUP$LexParse$stack.peek()).left;
+ int identright = ((java_cup.runtime.Symbol)CUP$LexParse$stack.peek()).right;
+ String ident = (String)((java_cup.runtime.Symbol) CUP$LexParse$stack.peek()).value;
+
+ if ( !scanner.macroDefinition ) {
+ if ( ! macros.markUsed(ident) )
+ throw new ScannerException(scanner.file, ErrorMessages.MACRO_UNDECL,
+ identleft, identright);
+ }
+ RESULT = new RegExp1(sym.MACROUSE, ident);
+
+ CUP$LexParse$result = parser.getSymbolFactory().newSymbol("regexp",7, ((java_cup.runtime.Symbol)CUP$LexParse$stack.peek()), ((java_cup.runtime.Symbol)CUP$LexParse$stack.peek()), RESULT);
+ }
+ return CUP$LexParse$result;
+
+ /*. . . . . . . . . . . . . . . . . . . .*/
+ case 46: // regexp ::= OPENBRACKET series CLOSEBRACKET
+ {
+ RegExp RESULT =null;
+ int rleft = ((java_cup.runtime.Symbol)CUP$LexParse$stack.elementAt(CUP$LexParse$top-1)).left;
+ int rright = ((java_cup.runtime.Symbol)CUP$LexParse$stack.elementAt(CUP$LexParse$top-1)).right;
+ RegExp r = (RegExp)((java_cup.runtime.Symbol) CUP$LexParse$stack.elementAt(CUP$LexParse$top-1)).value;
+ RESULT = r;
+ CUP$LexParse$result = parser.getSymbolFactory().newSymbol("regexp",7, ((java_cup.runtime.Symbol)CUP$LexParse$stack.elementAt(CUP$LexParse$top-2)), ((java_cup.runtime.Symbol)CUP$LexParse$stack.peek()), RESULT);
+ }
+ return CUP$LexParse$result;
+
+ /*. . . . . . . . . . . . . . . . . . . .*/
+ case 45: // regexp ::= regexp REPEAT REPEAT RBRACE
+ {
+ RegExp RESULT =null;
+ int rleft = ((java_cup.runtime.Symbol)CUP$LexParse$stack.elementAt(CUP$LexParse$top-3)).left;
+ int rright = ((java_cup.runtime.Symbol)CUP$LexParse$stack.elementAt(CUP$LexParse$top-3)).right;
+ RegExp r = (RegExp)((java_cup.runtime.Symbol) CUP$LexParse$stack.elementAt(CUP$LexParse$top-3)).value;
+ int n1left = ((java_cup.runtime.Symbol)CUP$LexParse$stack.elementAt(CUP$LexParse$top-2)).left;
+ int n1right = ((java_cup.runtime.Symbol)CUP$LexParse$stack.elementAt(CUP$LexParse$top-2)).right;
+ Integer n1 = (Integer)((java_cup.runtime.Symbol) CUP$LexParse$stack.elementAt(CUP$LexParse$top-2)).value;
+ int n2left = ((java_cup.runtime.Symbol)CUP$LexParse$stack.elementAt(CUP$LexParse$top-1)).left;
+ int n2right = ((java_cup.runtime.Symbol)CUP$LexParse$stack.elementAt(CUP$LexParse$top-1)).right;
+ Integer n2 = (Integer)((java_cup.runtime.Symbol) CUP$LexParse$stack.elementAt(CUP$LexParse$top-1)).value;
+ RESULT = makeRepeat(r, n1.intValue(), n2.intValue(), n1left, n2right);
+ CUP$LexParse$result = parser.getSymbolFactory().newSymbol("regexp",7, ((java_cup.runtime.Symbol)CUP$LexParse$stack.elementAt(CUP$LexParse$top-3)), ((java_cup.runtime.Symbol)CUP$LexParse$stack.peek()), RESULT);
+ }
+ return CUP$LexParse$result;
+
+ /*. . . . . . . . . . . . . . . . . . . .*/
+ case 44: // regexp ::= regexp REPEAT RBRACE
+ {
+ RegExp RESULT =null;
+ int rleft = ((java_cup.runtime.Symbol)CUP$LexParse$stack.elementAt(CUP$LexParse$top-2)).left;
+ int rright = ((java_cup.runtime.Symbol)CUP$LexParse$stack.elementAt(CUP$LexParse$top-2)).right;
+ RegExp r = (RegExp)((java_cup.runtime.Symbol) CUP$LexParse$stack.elementAt(CUP$LexParse$top-2)).value;
+ int nleft = ((java_cup.runtime.Symbol)CUP$LexParse$stack.elementAt(CUP$LexParse$top-1)).left;
+ int nright = ((java_cup.runtime.Symbol)CUP$LexParse$stack.elementAt(CUP$LexParse$top-1)).right;
+ Integer n = (Integer)((java_cup.runtime.Symbol) CUP$LexParse$stack.elementAt(CUP$LexParse$top-1)).value;
+ int bleft = ((java_cup.runtime.Symbol)CUP$LexParse$stack.peek()).left;
+ int bright = ((java_cup.runtime.Symbol)CUP$LexParse$stack.peek()).right;
+ Object b = (Object)((java_cup.runtime.Symbol) CUP$LexParse$stack.peek()).value;
+ RESULT = makeRepeat(r, n.intValue(), n.intValue(), bleft, bright);
+ CUP$LexParse$result = parser.getSymbolFactory().newSymbol("regexp",7, ((java_cup.runtime.Symbol)CUP$LexParse$stack.elementAt(CUP$LexParse$top-2)), ((java_cup.runtime.Symbol)CUP$LexParse$stack.peek()), RESULT);
+ }
+ return CUP$LexParse$result;
+
+ /*. . . . . . . . . . . . . . . . . . . .*/
+ case 43: // regexp ::= regexp QUESTION
+ {
+ RegExp RESULT =null;
+ int rleft = ((java_cup.runtime.Symbol)CUP$LexParse$stack.elementAt(CUP$LexParse$top-1)).left;
+ int rright = ((java_cup.runtime.Symbol)CUP$LexParse$stack.elementAt(CUP$LexParse$top-1)).right;
+ RegExp r = (RegExp)((java_cup.runtime.Symbol) CUP$LexParse$stack.elementAt(CUP$LexParse$top-1)).value;
+ RESULT = new RegExp1(sym.QUESTION, r);
+ CUP$LexParse$result = parser.getSymbolFactory().newSymbol("regexp",7, ((java_cup.runtime.Symbol)CUP$LexParse$stack.elementAt(CUP$LexParse$top-1)), ((java_cup.runtime.Symbol)CUP$LexParse$stack.peek()), RESULT);
+ }
+ return CUP$LexParse$result;
+
+ /*. . . . . . . . . . . . . . . . . . . .*/
+ case 42: // regexp ::= regexp PLUS
+ {
+ RegExp RESULT =null;
+ int rleft = ((java_cup.runtime.Symbol)CUP$LexParse$stack.elementAt(CUP$LexParse$top-1)).left;
+ int rright = ((java_cup.runtime.Symbol)CUP$LexParse$stack.elementAt(CUP$LexParse$top-1)).right;
+ RegExp r = (RegExp)((java_cup.runtime.Symbol) CUP$LexParse$stack.elementAt(CUP$LexParse$top-1)).value;
+ RESULT = new RegExp1(sym.PLUS, r);
+ CUP$LexParse$result = parser.getSymbolFactory().newSymbol("regexp",7, ((java_cup.runtime.Symbol)CUP$LexParse$stack.elementAt(CUP$LexParse$top-1)), ((java_cup.runtime.Symbol)CUP$LexParse$stack.peek()), RESULT);
+ }
+ return CUP$LexParse$result;
+
+ /*. . . . . . . . . . . . . . . . . . . .*/
+ case 41: // regexp ::= regexp STAR
+ {
+ RegExp RESULT =null;
+ int rleft = ((java_cup.runtime.Symbol)CUP$LexParse$stack.elementAt(CUP$LexParse$top-1)).left;
+ int rright = ((java_cup.runtime.Symbol)CUP$LexParse$stack.elementAt(CUP$LexParse$top-1)).right;
+ RegExp r = (RegExp)((java_cup.runtime.Symbol) CUP$LexParse$stack.elementAt(CUP$LexParse$top-1)).value;
+ RESULT = new RegExp1(sym.STAR, r);
+ CUP$LexParse$result = parser.getSymbolFactory().newSymbol("regexp",7, ((java_cup.runtime.Symbol)CUP$LexParse$stack.elementAt(CUP$LexParse$top-1)), ((java_cup.runtime.Symbol)CUP$LexParse$stack.peek()), RESULT);
+ }
+ return CUP$LexParse$result;
+
+ /*. . . . . . . . . . . . . . . . . . . .*/
+ case 40: // nregexp ::= TILDE nregexp
+ {
+ RegExp RESULT =null;
+ int rleft = ((java_cup.runtime.Symbol)CUP$LexParse$stack.peek()).left;
+ int rright = ((java_cup.runtime.Symbol)CUP$LexParse$stack.peek()).right;
+ RegExp r = (RegExp)((java_cup.runtime.Symbol) CUP$LexParse$stack.peek()).value;
+ RESULT = new RegExp1(sym.TILDE, r);
+ CUP$LexParse$result = parser.getSymbolFactory().newSymbol("nregexp",6, ((java_cup.runtime.Symbol)CUP$LexParse$stack.elementAt(CUP$LexParse$top-1)), ((java_cup.runtime.Symbol)CUP$LexParse$stack.peek()), RESULT);
+ }
+ return CUP$LexParse$result;
+
+ /*. . . . . . . . . . . . . . . . . . . .*/
+ case 39: // nregexp ::= BANG nregexp
+ {
+ RegExp RESULT =null;
+ int rleft = ((java_cup.runtime.Symbol)CUP$LexParse$stack.peek()).left;
+ int rright = ((java_cup.runtime.Symbol)CUP$LexParse$stack.peek()).right;
+ RegExp r = (RegExp)((java_cup.runtime.Symbol) CUP$LexParse$stack.peek()).value;
+ RESULT = new RegExp1(sym.BANG, r);
+ CUP$LexParse$result = parser.getSymbolFactory().newSymbol("nregexp",6, ((java_cup.runtime.Symbol)CUP$LexParse$stack.elementAt(CUP$LexParse$top-1)), ((java_cup.runtime.Symbol)CUP$LexParse$stack.peek()), RESULT);
+ }
+ return CUP$LexParse$result;
+
+ /*. . . . . . . . . . . . . . . . . . . .*/
+ case 38: // nregexp ::= regexp
+ {
+ RegExp RESULT =null;
+ int rleft = ((java_cup.runtime.Symbol)CUP$LexParse$stack.peek()).left;
+ int rright = ((java_cup.runtime.Symbol)CUP$LexParse$stack.peek()).right;
+ RegExp r = (RegExp)((java_cup.runtime.Symbol) CUP$LexParse$stack.peek()).value;
+ RESULT = r;
+ CUP$LexParse$result = parser.getSymbolFactory().newSymbol("nregexp",6, ((java_cup.runtime.Symbol)CUP$LexParse$stack.peek()), ((java_cup.runtime.Symbol)CUP$LexParse$stack.peek()), RESULT);
+ }
+ return CUP$LexParse$result;
+
+ /*. . . . . . . . . . . . . . . . . . . .*/
+ case 37: // concs ::= nregexp
+ {
+ RegExp RESULT =null;
+ int rleft = ((java_cup.runtime.Symbol)CUP$LexParse$stack.peek()).left;
+ int rright = ((java_cup.runtime.Symbol)CUP$LexParse$stack.peek()).right;
+ RegExp r = (RegExp)((java_cup.runtime.Symbol) CUP$LexParse$stack.peek()).value;
+ RESULT = r;
+ CUP$LexParse$result = parser.getSymbolFactory().newSymbol("concs",5, ((java_cup.runtime.Symbol)CUP$LexParse$stack.peek()), ((java_cup.runtime.Symbol)CUP$LexParse$stack.peek()), RESULT);
+ }
+ return CUP$LexParse$result;
+
+ /*. . . . . . . . . . . . . . . . . . . .*/
+ case 36: // concs ::= concs nregexp
+ {
+ RegExp RESULT =null;
+ int r1left = ((java_cup.runtime.Symbol)CUP$LexParse$stack.elementAt(CUP$LexParse$top-1)).left;
+ int r1right = ((java_cup.runtime.Symbol)CUP$LexParse$stack.elementAt(CUP$LexParse$top-1)).right;
+ RegExp r1 = (RegExp)((java_cup.runtime.Symbol) CUP$LexParse$stack.elementAt(CUP$LexParse$top-1)).value;
+ int r2left = ((java_cup.runtime.Symbol)CUP$LexParse$stack.peek()).left;
+ int r2right = ((java_cup.runtime.Symbol)CUP$LexParse$stack.peek()).right;
+ RegExp r2 = (RegExp)((java_cup.runtime.Symbol) CUP$LexParse$stack.peek()).value;
+ RESULT = new RegExp2(sym.CONCAT, r1, r2);
+ CUP$LexParse$result = parser.getSymbolFactory().newSymbol("concs",5, ((java_cup.runtime.Symbol)CUP$LexParse$stack.elementAt(CUP$LexParse$top-1)), ((java_cup.runtime.Symbol)CUP$LexParse$stack.peek()), RESULT);
+ }
+ return CUP$LexParse$result;
+
+ /*. . . . . . . . . . . . . . . . . . . .*/
+ case 35: // series ::= BAR
+ {
+ RegExp RESULT =null;
+ int bleft = ((java_cup.runtime.Symbol)CUP$LexParse$stack.peek()).left;
+ int bright = ((java_cup.runtime.Symbol)CUP$LexParse$stack.peek()).right;
+ Object b = (Object)((java_cup.runtime.Symbol) CUP$LexParse$stack.peek()).value;
+ syntaxError(ErrorMessages.REGEXP_EXPECTED, bleft, bright);
+ CUP$LexParse$result = parser.getSymbolFactory().newSymbol("series",4, ((java_cup.runtime.Symbol)CUP$LexParse$stack.peek()), ((java_cup.runtime.Symbol)CUP$LexParse$stack.peek()), RESULT);
+ }
+ return CUP$LexParse$result;
+
+ /*. . . . . . . . . . . . . . . . . . . .*/
+ case 34: // series ::= concs
+ {
+ RegExp RESULT =null;
+ int rleft = ((java_cup.runtime.Symbol)CUP$LexParse$stack.peek()).left;
+ int rright = ((java_cup.runtime.Symbol)CUP$LexParse$stack.peek()).right;
+ RegExp r = (RegExp)((java_cup.runtime.Symbol) CUP$LexParse$stack.peek()).value;
+ RESULT = r;
+ CUP$LexParse$result = parser.getSymbolFactory().newSymbol("series",4, ((java_cup.runtime.Symbol)CUP$LexParse$stack.peek()), ((java_cup.runtime.Symbol)CUP$LexParse$stack.peek()), RESULT);
+ }
+ return CUP$LexParse$result;
+
+ /*. . . . . . . . . . . . . . . . . . . .*/
+ case 33: // series ::= series BAR concs
+ {
+ RegExp RESULT =null;
+ int r1left = ((java_cup.runtime.Symbol)CUP$LexParse$stack.elementAt(CUP$LexParse$top-2)).left;
+ int r1right = ((java_cup.runtime.Symbol)CUP$LexParse$stack.elementAt(CUP$LexParse$top-2)).right;
+ RegExp r1 = (RegExp)((java_cup.runtime.Symbol) CUP$LexParse$stack.elementAt(CUP$LexParse$top-2)).value;
+ int r2left = ((java_cup.runtime.Symbol)CUP$LexParse$stack.peek()).left;
+ int r2right = ((java_cup.runtime.Symbol)CUP$LexParse$stack.peek()).right;
+ RegExp r2 = (RegExp)((java_cup.runtime.Symbol) CUP$LexParse$stack.peek()).value;
+ RESULT = new RegExp2(sym.BAR, r1, r2);
+ CUP$LexParse$result = parser.getSymbolFactory().newSymbol("series",4, ((java_cup.runtime.Symbol)CUP$LexParse$stack.elementAt(CUP$LexParse$top-2)), ((java_cup.runtime.Symbol)CUP$LexParse$stack.peek()), RESULT);
+ }
+ return CUP$LexParse$result;
+
+ /*. . . . . . . . . . . . . . . . . . . .*/
+ case 32: // hatOPT ::=
+ {
+ Boolean RESULT =null;
+ RESULT = new Boolean(false);
+ CUP$LexParse$result = parser.getSymbolFactory().newSymbol("hatOPT",16, ((java_cup.runtime.Symbol)CUP$LexParse$stack.peek()), ((java_cup.runtime.Symbol)CUP$LexParse$stack.peek()), RESULT);
+ }
+ return CUP$LexParse$result;
+
+ /*. . . . . . . . . . . . . . . . . . . .*/
+ case 31: // hatOPT ::= HAT
+ {
+ Boolean RESULT =null;
+ // assumption: there is no upper case for \n
+ charClasses.makeClass('\n', false);
+ RESULT = new Boolean(true);
+ CUP$LexParse$result = parser.getSymbolFactory().newSymbol("hatOPT",16, ((java_cup.runtime.Symbol)CUP$LexParse$stack.peek()), ((java_cup.runtime.Symbol)CUP$LexParse$stack.peek()), RESULT);
+ }
+ return CUP$LexParse$result;
+
+ /*. . . . . . . . . . . . . . . . . . . .*/
+ case 30: // states ::= IDENT COMMA
+ {
+ Vector RESULT =null;
+ int cleft = ((java_cup.runtime.Symbol)CUP$LexParse$stack.peek()).left;
+ int cright = ((java_cup.runtime.Symbol)CUP$LexParse$stack.peek()).right;
+ Object c = (Object)((java_cup.runtime.Symbol) CUP$LexParse$stack.peek()).value;
+ syntaxError(ErrorMessages.REGEXP_EXPECTED, cleft, cright+1);
+ CUP$LexParse$result = parser.getSymbolFactory().newSymbol("states",11, ((java_cup.runtime.Symbol)CUP$LexParse$stack.elementAt(CUP$LexParse$top-1)), ((java_cup.runtime.Symbol)CUP$LexParse$stack.peek()), RESULT);
+ }
+ return CUP$LexParse$result;
+
+ /*. . . . . . . . . . . . . . . . . . . .*/
+ case 29: // states ::= IDENT
+ {
+ Vector RESULT =null;
+ int idleft = ((java_cup.runtime.Symbol)CUP$LexParse$stack.peek()).left;
+ int idright = ((java_cup.runtime.Symbol)CUP$LexParse$stack.peek()).right;
+ String id = (String)((java_cup.runtime.Symbol) CUP$LexParse$stack.peek()).value;
+
+ Vector list = new Vector();
+ stateNumber = scanner.states.getNumber( id );
+ if ( stateNumber != null )
+ list.addElement( stateNumber );
+ else {
+ throw new ScannerException(scanner.file, ErrorMessages.LEXSTATE_UNDECL,
+ idleft, idright);
+ }
+ RESULT = list;
+
+ CUP$LexParse$result = parser.getSymbolFactory().newSymbol("states",11, ((java_cup.runtime.Symbol)CUP$LexParse$stack.peek()), ((java_cup.runtime.Symbol)CUP$LexParse$stack.peek()), RESULT);
+ }
+ return CUP$LexParse$result;
+
+ /*. . . . . . . . . . . . . . . . . . . .*/
+ case 28: // states ::= IDENT COMMA states
+ {
+ Vector RESULT =null;
+ int idleft = ((java_cup.runtime.Symbol)CUP$LexParse$stack.elementAt(CUP$LexParse$top-2)).left;
+ int idright = ((java_cup.runtime.Symbol)CUP$LexParse$stack.elementAt(CUP$LexParse$top-2)).right;
+ String id = (String)((java_cup.runtime.Symbol) CUP$LexParse$stack.elementAt(CUP$LexParse$top-2)).value;
+ int listleft = ((java_cup.runtime.Symbol)CUP$LexParse$stack.peek()).left;
+ int listright = ((java_cup.runtime.Symbol)CUP$LexParse$stack.peek()).right;
+ Vector list = (Vector)((java_cup.runtime.Symbol) CUP$LexParse$stack.peek()).value;
+
+ stateNumber = scanner.states.getNumber( id );
+ if ( stateNumber != null )
+ list.addElement( stateNumber );
+ else {
+ throw new ScannerException(scanner.file, ErrorMessages.LEXSTATE_UNDECL,
+ idleft, idright);
+ }
+ RESULT = list;
+
+ CUP$LexParse$result = parser.getSymbolFactory().newSymbol("states",11, ((java_cup.runtime.Symbol)CUP$LexParse$stack.elementAt(CUP$LexParse$top-2)), ((java_cup.runtime.Symbol)CUP$LexParse$stack.peek()), RESULT);
+ }
+ return CUP$LexParse$result;
+
+ /*. . . . . . . . . . . . . . . . . . . .*/
+ case 27: // statesOPT ::=
+ {
+ Vector RESULT =null;
+ RESULT = new Vector();
+ CUP$LexParse$result = parser.getSymbolFactory().newSymbol("statesOPT",12, ((java_cup.runtime.Symbol)CUP$LexParse$stack.peek()), ((java_cup.runtime.Symbol)CUP$LexParse$stack.peek()), RESULT);
+ }
+ return CUP$LexParse$result;
+
+ /*. . . . . . . . . . . . . . . . . . . .*/
+ case 26: // statesOPT ::= LESSTHAN states MORETHAN
+ {
+ Vector RESULT =null;
+ int listleft = ((java_cup.runtime.Symbol)CUP$LexParse$stack.elementAt(CUP$LexParse$top-1)).left;
+ int listright = ((java_cup.runtime.Symbol)CUP$LexParse$stack.elementAt(CUP$LexParse$top-1)).right;
+ Vector list = (Vector)((java_cup.runtime.Symbol) CUP$LexParse$stack.elementAt(CUP$LexParse$top-1)).value;
+ RESULT = list;
+ CUP$LexParse$result = parser.getSymbolFactory().newSymbol("statesOPT",12, ((java_cup.runtime.Symbol)CUP$LexParse$stack.elementAt(CUP$LexParse$top-2)), ((java_cup.runtime.Symbol)CUP$LexParse$stack.peek()), RESULT);
+ }
+ return CUP$LexParse$result;
+
+ /*. . . . . . . . . . . . . . . . . . . .*/
+ case 25: // actions ::= NOACTION
+ {
+ Action RESULT =null;
+
+ CUP$LexParse$result = parser.getSymbolFactory().newSymbol("actions",18, ((java_cup.runtime.Symbol)CUP$LexParse$stack.peek()), ((java_cup.runtime.Symbol)CUP$LexParse$stack.peek()), RESULT);
+ }
+ return CUP$LexParse$result;
+
+ /*. . . . . . . . . . . . . . . . . . . .*/
+ case 24: // actions ::= act
+ {
+ Action RESULT =null;
+ int aleft = ((java_cup.runtime.Symbol)CUP$LexParse$stack.peek()).left;
+ int aright = ((java_cup.runtime.Symbol)CUP$LexParse$stack.peek()).right;
+ Action a = (Action)((java_cup.runtime.Symbol) CUP$LexParse$stack.peek()).value;
+ RESULT = a;
+ CUP$LexParse$result = parser.getSymbolFactory().newSymbol("actions",18, ((java_cup.runtime.Symbol)CUP$LexParse$stack.peek()), ((java_cup.runtime.Symbol)CUP$LexParse$stack.peek()), RESULT);
+ }
+ return CUP$LexParse$result;
+
+ /*. . . . . . . . . . . . . . . . . . . .*/
+ case 23: // act ::= REGEXPEND ACTION
+ {
+ Action RESULT =null;
+ int aleft = ((java_cup.runtime.Symbol)CUP$LexParse$stack.peek()).left;
+ int aright = ((java_cup.runtime.Symbol)CUP$LexParse$stack.peek()).right;
+ Action a = (Action)((java_cup.runtime.Symbol) CUP$LexParse$stack.peek()).value;
+ RESULT = a;
+ CUP$LexParse$result = parser.getSymbolFactory().newSymbol("act",17, ((java_cup.runtime.Symbol)CUP$LexParse$stack.elementAt(CUP$LexParse$top-1)), ((java_cup.runtime.Symbol)CUP$LexParse$stack.peek()), RESULT);
+ }
+ return CUP$LexParse$result;
+
+ /*. . . . . . . . . . . . . . . . . . . .*/
+ case 22: // lookahead ::= LOOKAHEAD series DOLLAR
+ {
+ RegExp RESULT =null;
+ int sleft = ((java_cup.runtime.Symbol)CUP$LexParse$stack.elementAt(CUP$LexParse$top-1)).left;
+ int sright = ((java_cup.runtime.Symbol)CUP$LexParse$stack.elementAt(CUP$LexParse$top-1)).right;
+ RegExp s = (RegExp)((java_cup.runtime.Symbol) CUP$LexParse$stack.elementAt(CUP$LexParse$top-1)).value;
+ RESULT = new RegExp2(sym.CONCAT, s, makeNL());
+ CUP$LexParse$result = parser.getSymbolFactory().newSymbol("lookahead",9, ((java_cup.runtime.Symbol)CUP$LexParse$stack.elementAt(CUP$LexParse$top-2)), ((java_cup.runtime.Symbol)CUP$LexParse$stack.peek()), RESULT);
+ }
+ return CUP$LexParse$result;
+
+ /*. . . . . . . . . . . . . . . . . . . .*/
+ case 21: // lookahead ::= LOOKAHEAD series
+ {
+ RegExp RESULT =null;
+ int rleft = ((java_cup.runtime.Symbol)CUP$LexParse$stack.peek()).left;
+ int rright = ((java_cup.runtime.Symbol)CUP$LexParse$stack.peek()).right;
+ RegExp r = (RegExp)((java_cup.runtime.Symbol) CUP$LexParse$stack.peek()).value;
+ RESULT = r;
+ CUP$LexParse$result = parser.getSymbolFactory().newSymbol("lookahead",9, ((java_cup.runtime.Symbol)CUP$LexParse$stack.elementAt(CUP$LexParse$top-1)), ((java_cup.runtime.Symbol)CUP$LexParse$stack.peek()), RESULT);
+ }
+ return CUP$LexParse$result;
+
+ /*. . . . . . . . . . . . . . . . . . . .*/
+ case 20: // lookahead ::= DOLLAR
+ {
+ RegExp RESULT =null;
+ RESULT = makeNL();
+ CUP$LexParse$result = parser.getSymbolFactory().newSymbol("lookahead",9, ((java_cup.runtime.Symbol)CUP$LexParse$stack.peek()), ((java_cup.runtime.Symbol)CUP$LexParse$stack.peek()), RESULT);
+ }
+ return CUP$LexParse$result;
+
+ /*. . . . . . . . . . . . . . . . . . . .*/
+ case 19: // rule ::= error
+ {
+ Integer RESULT =null;
+
+ CUP$LexParse$result = parser.getSymbolFactory().newSymbol("rule",2, ((java_cup.runtime.Symbol)CUP$LexParse$stack.peek()), ((java_cup.runtime.Symbol)CUP$LexParse$stack.peek()), RESULT);
+ }
+ return CUP$LexParse$result;
+
+ /*. . . . . . . . . . . . . . . . . . . .*/
+ case 18: // rule ::= statesOPT EOFRULE ACTION
+ {
+ Integer RESULT =null;
+ int sleft = ((java_cup.runtime.Symbol)CUP$LexParse$stack.elementAt(CUP$LexParse$top-2)).left;
+ int sright = ((java_cup.runtime.Symbol)CUP$LexParse$stack.elementAt(CUP$LexParse$top-2)).right;
+ Vector s = (Vector)((java_cup.runtime.Symbol) CUP$LexParse$stack.elementAt(CUP$LexParse$top-2)).value;
+ int aleft = ((java_cup.runtime.Symbol)CUP$LexParse$stack.peek()).left;
+ int aright = ((java_cup.runtime.Symbol)CUP$LexParse$stack.peek()).right;
+ Action a = (Action)((java_cup.runtime.Symbol) CUP$LexParse$stack.peek()).value;
+ RESULT = new Integer(regExps.insert(s, a));
+ CUP$LexParse$result = parser.getSymbolFactory().newSymbol("rule",2, ((java_cup.runtime.Symbol)CUP$LexParse$stack.elementAt(CUP$LexParse$top-2)), ((java_cup.runtime.Symbol)CUP$LexParse$stack.peek()), RESULT);
+ }
+ return CUP$LexParse$result;
+
+ /*. . . . . . . . . . . . . . . . . . . .*/
+ case 17: // rule ::= statesOPT hatOPT series lookahead NOACTION
+ {
+ Integer RESULT =null;
+ int sleft = ((java_cup.runtime.Symbol)CUP$LexParse$stack.elementAt(CUP$LexParse$top-4)).left;
+ int sright = ((java_cup.runtime.Symbol)CUP$LexParse$stack.elementAt(CUP$LexParse$top-4)).right;
+ Vector s = (Vector)((java_cup.runtime.Symbol) CUP$LexParse$stack.elementAt(CUP$LexParse$top-4)).value;
+ int bolleft = ((java_cup.runtime.Symbol)CUP$LexParse$stack.elementAt(CUP$LexParse$top-3)).left;
+ int bolright = ((java_cup.runtime.Symbol)CUP$LexParse$stack.elementAt(CUP$LexParse$top-3)).right;
+ Boolean bol = (Boolean)((java_cup.runtime.Symbol) CUP$LexParse$stack.elementAt(CUP$LexParse$top-3)).value;
+ int rleft = ((java_cup.runtime.Symbol)CUP$LexParse$stack.elementAt(CUP$LexParse$top-2)).left;
+ int rright = ((java_cup.runtime.Symbol)CUP$LexParse$stack.elementAt(CUP$LexParse$top-2)).right;
+ RegExp r = (RegExp)((java_cup.runtime.Symbol) CUP$LexParse$stack.elementAt(CUP$LexParse$top-2)).value;
+ int lleft = ((java_cup.runtime.Symbol)CUP$LexParse$stack.elementAt(CUP$LexParse$top-1)).left;
+ int lright = ((java_cup.runtime.Symbol)CUP$LexParse$stack.elementAt(CUP$LexParse$top-1)).right;
+ RegExp l = (RegExp)((java_cup.runtime.Symbol) CUP$LexParse$stack.elementAt(CUP$LexParse$top-1)).value;
+ int aleft = ((java_cup.runtime.Symbol)CUP$LexParse$stack.peek()).left;
+ int aright = ((java_cup.runtime.Symbol)CUP$LexParse$stack.peek()).right;
+ Object a = (Object)((java_cup.runtime.Symbol) CUP$LexParse$stack.peek()).value;
+ syntaxError(ErrorMessages.LOOKAHEAD_NEEDS_ACTION, aleft, aright+1);
+ CUP$LexParse$result = parser.getSymbolFactory().newSymbol("rule",2, ((java_cup.runtime.Symbol)CUP$LexParse$stack.elementAt(CUP$LexParse$top-4)), ((java_cup.runtime.Symbol)CUP$LexParse$stack.peek()), RESULT);
+ }
+ return CUP$LexParse$result;
+
+ /*. . . . . . . . . . . . . . . . . . . .*/
+ case 16: // rule ::= statesOPT hatOPT series lookahead act
+ {
+ Integer RESULT =null;
+ int sleft = ((java_cup.runtime.Symbol)CUP$LexParse$stack.elementAt(CUP$LexParse$top-4)).left;
+ int sright = ((java_cup.runtime.Symbol)CUP$LexParse$stack.elementAt(CUP$LexParse$top-4)).right;
+ Vector s = (Vector)((java_cup.runtime.Symbol) CUP$LexParse$stack.elementAt(CUP$LexParse$top-4)).value;
+ int bolleft = ((java_cup.runtime.Symbol)CUP$LexParse$stack.elementAt(CUP$LexParse$top-3)).left;
+ int bolright = ((java_cup.runtime.Symbol)CUP$LexParse$stack.elementAt(CUP$LexParse$top-3)).right;
+ Boolean bol = (Boolean)((java_cup.runtime.Symbol) CUP$LexParse$stack.elementAt(CUP$LexParse$top-3)).value;
+ int rleft = ((java_cup.runtime.Symbol)CUP$LexParse$stack.elementAt(CUP$LexParse$top-2)).left;
+ int rright = ((java_cup.runtime.Symbol)CUP$LexParse$stack.elementAt(CUP$LexParse$top-2)).right;
+ RegExp r = (RegExp)((java_cup.runtime.Symbol) CUP$LexParse$stack.elementAt(CUP$LexParse$top-2)).value;
+ int lleft = ((java_cup.runtime.Symbol)CUP$LexParse$stack.elementAt(CUP$LexParse$top-1)).left;
+ int lright = ((java_cup.runtime.Symbol)CUP$LexParse$stack.elementAt(CUP$LexParse$top-1)).right;
+ RegExp l = (RegExp)((java_cup.runtime.Symbol) CUP$LexParse$stack.elementAt(CUP$LexParse$top-1)).value;
+ int aleft = ((java_cup.runtime.Symbol)CUP$LexParse$stack.peek()).left;
+ int aright = ((java_cup.runtime.Symbol)CUP$LexParse$stack.peek()).right;
+ Action a = (Action)((java_cup.runtime.Symbol) CUP$LexParse$stack.peek()).value;
+ RESULT = new Integer(regExps.insert(rleft, s, r, a, bol, l));
+ CUP$LexParse$result = parser.getSymbolFactory().newSymbol("rule",2, ((java_cup.runtime.Symbol)CUP$LexParse$stack.elementAt(CUP$LexParse$top-4)), ((java_cup.runtime.Symbol)CUP$LexParse$stack.peek()), RESULT);
+ }
+ return CUP$LexParse$result;
+
+ /*. . . . . . . . . . . . . . . . . . . .*/
+ case 15: // rule ::= statesOPT hatOPT series actions
+ {
+ Integer RESULT =null;
+ int sleft = ((java_cup.runtime.Symbol)CUP$LexParse$stack.elementAt(CUP$LexParse$top-3)).left;
+ int sright = ((java_cup.runtime.Symbol)CUP$LexParse$stack.elementAt(CUP$LexParse$top-3)).right;
+ Vector s = (Vector)((java_cup.runtime.Symbol) CUP$LexParse$stack.elementAt(CUP$LexParse$top-3)).value;
+ int bolleft = ((java_cup.runtime.Symbol)CUP$LexParse$stack.elementAt(CUP$LexParse$top-2)).left;
+ int bolright = ((java_cup.runtime.Symbol)CUP$LexParse$stack.elementAt(CUP$LexParse$top-2)).right;
+ Boolean bol = (Boolean)((java_cup.runtime.Symbol) CUP$LexParse$stack.elementAt(CUP$LexParse$top-2)).value;
+ int rleft = ((java_cup.runtime.Symbol)CUP$LexParse$stack.elementAt(CUP$LexParse$top-1)).left;
+ int rright = ((java_cup.runtime.Symbol)CUP$LexParse$stack.elementAt(CUP$LexParse$top-1)).right;
+ RegExp r = (RegExp)((java_cup.runtime.Symbol) CUP$LexParse$stack.elementAt(CUP$LexParse$top-1)).value;
+ int aleft = ((java_cup.runtime.Symbol)CUP$LexParse$stack.peek()).left;
+ int aright = ((java_cup.runtime.Symbol)CUP$LexParse$stack.peek()).right;
+ Action a = (Action)((java_cup.runtime.Symbol) CUP$LexParse$stack.peek()).value;
+ RESULT = new Integer(regExps.insert(rleft, s, r, a, bol, null));
+ CUP$LexParse$result = parser.getSymbolFactory().newSymbol("rule",2, ((java_cup.runtime.Symbol)CUP$LexParse$stack.elementAt(CUP$LexParse$top-3)), ((java_cup.runtime.Symbol)CUP$LexParse$stack.peek()), RESULT);
+ }
+ return CUP$LexParse$result;
+
+ /*. . . . . . . . . . . . . . . . . . . .*/
+ case 14: // rules ::= rule
+ {
+ Vector RESULT =null;
+ int rleft = ((java_cup.runtime.Symbol)CUP$LexParse$stack.peek()).left;
+ int rright = ((java_cup.runtime.Symbol)CUP$LexParse$stack.peek()).right;
+ Integer r = (Integer)((java_cup.runtime.Symbol) CUP$LexParse$stack.peek()).value;
+ RESULT = new Vector(); RESULT.addElement(r);
+ CUP$LexParse$result = parser.getSymbolFactory().newSymbol("rules",15, ((java_cup.runtime.Symbol)CUP$LexParse$stack.peek()), ((java_cup.runtime.Symbol)CUP$LexParse$stack.peek()), RESULT);
+ }
+ return CUP$LexParse$result;
+
+ /*. . . . . . . . . . . . . . . . . . . .*/
+ case 13: // rules ::= LESSTHAN states MORETHAN LBRACE rules RBRACE
+ {
+ Vector RESULT =null;
+ int statesleft = ((java_cup.runtime.Symbol)CUP$LexParse$stack.elementAt(CUP$LexParse$top-4)).left;
+ int statesright = ((java_cup.runtime.Symbol)CUP$LexParse$stack.elementAt(CUP$LexParse$top-4)).right;
+ Vector states = (Vector)((java_cup.runtime.Symbol) CUP$LexParse$stack.elementAt(CUP$LexParse$top-4)).value;
+ int rlistleft = ((java_cup.runtime.Symbol)CUP$LexParse$stack.elementAt(CUP$LexParse$top-1)).left;
+ int rlistright = ((java_cup.runtime.Symbol)CUP$LexParse$stack.elementAt(CUP$LexParse$top-1)).right;
+ Vector rlist = (Vector)((java_cup.runtime.Symbol) CUP$LexParse$stack.elementAt(CUP$LexParse$top-1)).value;
+
+ Enumeration rs = rlist.elements();
+ while ( rs.hasMoreElements() ) {
+ Integer elem = (Integer) rs.nextElement();
+ // might be null for error case of "rule"
+ if (elem != null) {
+ regExps.addStates( elem.intValue(), states );
+ }
+ }
+ RESULT = rlist;
+
+ CUP$LexParse$result = parser.getSymbolFactory().newSymbol("rules",15, ((java_cup.runtime.Symbol)CUP$LexParse$stack.elementAt(CUP$LexParse$top-5)), ((java_cup.runtime.Symbol)CUP$LexParse$stack.peek()), RESULT);
+ }
+ return CUP$LexParse$result;
+
+ /*. . . . . . . . . . . . . . . . . . . .*/
+ case 12: // rules ::= rules LESSTHAN states MORETHAN LBRACE rules RBRACE
+ {
+ Vector RESULT =null;
+ int rlist1left = ((java_cup.runtime.Symbol)CUP$LexParse$stack.elementAt(CUP$LexParse$top-6)).left;
+ int rlist1right = ((java_cup.runtime.Symbol)CUP$LexParse$stack.elementAt(CUP$LexParse$top-6)).right;
+ Vector rlist1 = (Vector)((java_cup.runtime.Symbol) CUP$LexParse$stack.elementAt(CUP$LexParse$top-6)).value;
+ int statesleft = ((java_cup.runtime.Symbol)CUP$LexParse$stack.elementAt(CUP$LexParse$top-4)).left;
+ int statesright = ((java_cup.runtime.Symbol)CUP$LexParse$stack.elementAt(CUP$LexParse$top-4)).right;
+ Vector states = (Vector)((java_cup.runtime.Symbol) CUP$LexParse$stack.elementAt(CUP$LexParse$top-4)).value;
+ int rlist2left = ((java_cup.runtime.Symbol)CUP$LexParse$stack.elementAt(CUP$LexParse$top-1)).left;
+ int rlist2right = ((java_cup.runtime.Symbol)CUP$LexParse$stack.elementAt(CUP$LexParse$top-1)).right;
+ Vector rlist2 = (Vector)((java_cup.runtime.Symbol) CUP$LexParse$stack.elementAt(CUP$LexParse$top-1)).value;
+
+ Enumeration rs = rlist2.elements();
+ while ( rs.hasMoreElements() ) {
+ Integer elem = (Integer) rs.nextElement();
+ // might be null for error case of "rule"
+ if (elem != null) {
+ regExps.addStates( elem.intValue(), states );
+ }
+ rlist1.addElement( elem );
+ }
+ RESULT = rlist1;
+
+ CUP$LexParse$result = parser.getSymbolFactory().newSymbol("rules",15, ((java_cup.runtime.Symbol)CUP$LexParse$stack.elementAt(CUP$LexParse$top-6)), ((java_cup.runtime.Symbol)CUP$LexParse$stack.peek()), RESULT);
+ }
+ return CUP$LexParse$result;
+
+ /*. . . . . . . . . . . . . . . . . . . .*/
+ case 11: // rules ::= rules rule
+ {
+ Vector RESULT =null;
+ int rlistleft = ((java_cup.runtime.Symbol)CUP$LexParse$stack.elementAt(CUP$LexParse$top-1)).left;
+ int rlistright = ((java_cup.runtime.Symbol)CUP$LexParse$stack.elementAt(CUP$LexParse$top-1)).right;
+ Vector rlist = (Vector)((java_cup.runtime.Symbol) CUP$LexParse$stack.elementAt(CUP$LexParse$top-1)).value;
+ int rleft = ((java_cup.runtime.Symbol)CUP$LexParse$stack.peek()).left;
+ int rright = ((java_cup.runtime.Symbol)CUP$LexParse$stack.peek()).right;
+ Integer r = (Integer)((java_cup.runtime.Symbol) CUP$LexParse$stack.peek()).value;
+ rlist.addElement(r); RESULT = rlist;
+ CUP$LexParse$result = parser.getSymbolFactory().newSymbol("rules",15, ((java_cup.runtime.Symbol)CUP$LexParse$stack.elementAt(CUP$LexParse$top-1)), ((java_cup.runtime.Symbol)CUP$LexParse$stack.peek()), RESULT);
+ }
+ return CUP$LexParse$result;
+
+ /*. . . . . . . . . . . . . . . . . . . .*/
+ case 10: // macro ::= IDENT EQUALS
+ {
+ Object RESULT =null;
+ int eleft = ((java_cup.runtime.Symbol)CUP$LexParse$stack.peek()).left;
+ int eright = ((java_cup.runtime.Symbol)CUP$LexParse$stack.peek()).right;
+ Object e = (Object)((java_cup.runtime.Symbol) CUP$LexParse$stack.peek()).value;
+ syntaxError(ErrorMessages.REGEXP_EXPECTED, eleft, eright);
+ CUP$LexParse$result = parser.getSymbolFactory().newSymbol("macro",1, ((java_cup.runtime.Symbol)CUP$LexParse$stack.elementAt(CUP$LexParse$top-1)), ((java_cup.runtime.Symbol)CUP$LexParse$stack.peek()), RESULT);
+ }
+ return CUP$LexParse$result;
+
+ /*. . . . . . . . . . . . . . . . . . . .*/
+ case 9: // macro ::= IDENT EQUALS series REGEXPEND
+ {
+ Object RESULT =null;
+ int nameleft = ((java_cup.runtime.Symbol)CUP$LexParse$stack.elementAt(CUP$LexParse$top-3)).left;
+ int nameright = ((java_cup.runtime.Symbol)CUP$LexParse$stack.elementAt(CUP$LexParse$top-3)).right;
+ String name = (String)((java_cup.runtime.Symbol) CUP$LexParse$stack.elementAt(CUP$LexParse$top-3)).value;
+ int definitionleft = ((java_cup.runtime.Symbol)CUP$LexParse$stack.elementAt(CUP$LexParse$top-1)).left;
+ int definitionright = ((java_cup.runtime.Symbol)CUP$LexParse$stack.elementAt(CUP$LexParse$top-1)).right;
+ RegExp definition = (RegExp)((java_cup.runtime.Symbol) CUP$LexParse$stack.elementAt(CUP$LexParse$top-1)).value;
+ macros.insert(name, definition);
+ CUP$LexParse$result = parser.getSymbolFactory().newSymbol("macro",1, ((java_cup.runtime.Symbol)CUP$LexParse$stack.elementAt(CUP$LexParse$top-3)), ((java_cup.runtime.Symbol)CUP$LexParse$stack.peek()), RESULT);
+ }
+ return CUP$LexParse$result;
+
+ /*. . . . . . . . . . . . . . . . . . . .*/
+ case 8: // macro ::= UNICODE
+ {
+ Object RESULT =null;
+ charClasses.setMaxCharCode(0xFFFF);
+ CUP$LexParse$result = parser.getSymbolFactory().newSymbol("macro",1, ((java_cup.runtime.Symbol)CUP$LexParse$stack.peek()), ((java_cup.runtime.Symbol)CUP$LexParse$stack.peek()), RESULT);
+ }
+ return CUP$LexParse$result;
+
+ /*. . . . . . . . . . . . . . . . . . . .*/
+ case 7: // macro ::= FULL
+ {
+ Object RESULT =null;
+ charClasses.setMaxCharCode(255);
+ CUP$LexParse$result = parser.getSymbolFactory().newSymbol("macro",1, ((java_cup.runtime.Symbol)CUP$LexParse$stack.peek()), ((java_cup.runtime.Symbol)CUP$LexParse$stack.peek()), RESULT);
+ }
+ return CUP$LexParse$result;
+
+ /*. . . . . . . . . . . . . . . . . . . .*/
+ case 6: // macro ::= ASCII
+ {
+ Object RESULT =null;
+ charClasses.setMaxCharCode(127);
+ CUP$LexParse$result = parser.getSymbolFactory().newSymbol("macro",1, ((java_cup.runtime.Symbol)CUP$LexParse$stack.peek()), ((java_cup.runtime.Symbol)CUP$LexParse$stack.peek()), RESULT);
+ }
+ return CUP$LexParse$result;
+
+ /*. . . . . . . . . . . . . . . . . . . .*/
+ case 5: // macros ::= error
+ {
+ Object RESULT =null;
+
+ CUP$LexParse$result = parser.getSymbolFactory().newSymbol("macros",0, ((java_cup.runtime.Symbol)CUP$LexParse$stack.peek()), ((java_cup.runtime.Symbol)CUP$LexParse$stack.peek()), RESULT);
+ }
+ return CUP$LexParse$result;
+
+ /*. . . . . . . . . . . . . . . . . . . .*/
+ case 4: // macros ::= macros macro
+ {
+ Object RESULT =null;
+
+ CUP$LexParse$result = parser.getSymbolFactory().newSymbol("macros",0, ((java_cup.runtime.Symbol)CUP$LexParse$stack.elementAt(CUP$LexParse$top-1)), ((java_cup.runtime.Symbol)CUP$LexParse$stack.peek()), RESULT);
+ }
+ return CUP$LexParse$result;
+
+ /*. . . . . . . . . . . . . . . . . . . .*/
+ case 3: // macros ::=
+ {
+ Object RESULT =null;
+
+ CUP$LexParse$result = parser.getSymbolFactory().newSymbol("macros",0, ((java_cup.runtime.Symbol)CUP$LexParse$stack.peek()), ((java_cup.runtime.Symbol)CUP$LexParse$stack.peek()), RESULT);
+ }
+ return CUP$LexParse$result;
+
+ /*. . . . . . . . . . . . . . . . . . . .*/
+ case 2: // specification ::=
+ {
+ NFA RESULT =null;
+
+ fatalError(ErrorMessages.NO_LEX_SPEC);
+
+ CUP$LexParse$result = parser.getSymbolFactory().newSymbol("specification",3, ((java_cup.runtime.Symbol)CUP$LexParse$stack.peek()), ((java_cup.runtime.Symbol)CUP$LexParse$stack.peek()), RESULT);
+ }
+ return CUP$LexParse$result;
+
+ /*. . . . . . . . . . . . . . . . . . . .*/
+ case 1: // specification ::= USERCODE macros DELIMITER rules
+ {
+ NFA RESULT =null;
+
+ scanner.t.stop();
+
+ Out.checkErrors();
+
+ Out.time(ErrorMessages.PARSING_TOOK, t);
+
+ macros.expand();
+ Enumeration unused = macros.unused();
+ while ( unused.hasMoreElements() ) {
+ Out.warning("Macro \""+unused.nextElement()+"\" has been declared but never used.");
+ }
+
+ SemCheck.check(regExps, macros, scanner.file);
+
+ regExps.checkActions();
+ regExps.checkLookAheads();
+
+ Out.checkErrors();
+
+ if (Options.dump) charClasses.dump();
+
+ Out.print("Constructing NFA : ");
+
+ t.start();
+ int num = regExps.getNum();
+
+ RESULT = new NFA(charClasses.getNumClasses(),
+ scanner, regExps, macros, charClasses);
+
+ eofActions.setNumLexStates(scanner.states.number());
+
+ for (int i = 0; i < num; i++) {
+ if (regExps.isEOF(i))
+ eofActions.add( regExps.getStates(i), regExps.getAction(i) );
+ else
+ RESULT.addRegExp(i);
+ }
+
+ if (scanner.standalone) RESULT.addStandaloneRule();
+ t.stop();
+
+ Out.time("");
+ Out.time(ErrorMessages.NFA_TOOK, t);
+
+
+ CUP$LexParse$result = parser.getSymbolFactory().newSymbol("specification",3, ((java_cup.runtime.Symbol)CUP$LexParse$stack.elementAt(CUP$LexParse$top-3)), ((java_cup.runtime.Symbol)CUP$LexParse$stack.peek()), RESULT);
+ }
+ return CUP$LexParse$result;
+
+ /*. . . . . . . . . . . . . . . . . . . .*/
+ case 0: // $START ::= specification EOF
+ {
+ Object RESULT =null;
+ int start_valleft = ((java_cup.runtime.Symbol)CUP$LexParse$stack.elementAt(CUP$LexParse$top-1)).left;
+ int start_valright = ((java_cup.runtime.Symbol)CUP$LexParse$stack.elementAt(CUP$LexParse$top-1)).right;
+ NFA start_val = (NFA)((java_cup.runtime.Symbol) CUP$LexParse$stack.elementAt(CUP$LexParse$top-1)).value;
+ RESULT = start_val;
+ CUP$LexParse$result = parser.getSymbolFactory().newSymbol("$START",0, ((java_cup.runtime.Symbol)CUP$LexParse$stack.elementAt(CUP$LexParse$top-1)), ((java_cup.runtime.Symbol)CUP$LexParse$stack.peek()), RESULT);
+ }
+ /* ACCEPT */
+ CUP$LexParse$parser.done_parsing();
+ return CUP$LexParse$result;
+
+ /* . . . . . .*/
+ default:
+ throw new Exception(
+ "Invalid action number found in internal parse table");
+
+ }
+ }
+}
+
Index: /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/src/JFlex/LexScan.flex
===================================================================
--- /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/src/JFlex/LexScan.flex (revision 25585)
+++ /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/src/JFlex/LexScan.flex (revision 25585)
@@ -0,0 +1,582 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * JFlex 1.4.3 *
+ * Copyright (C) 1998-2009 Gerwin Klein *
+ * All rights reserved. *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License. See the file *
+ * COPYRIGHT for more information. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License along *
+ * with this program; if not, write to the Free Software Foundation, Inc., *
+ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *
+ * *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+package JFlex;
+
+import java_cup.runtime.Symbol;
+import java.util.Vector;
+import java.io.*;
+import java.util.Stack;
+
+/**
+ * The lexer of JFlex.
+ *
+ * Generated by JFlex.
+ *
+ * @author Gerwin Klein
+ * @version JFlex 1.4.3, $Revision: 433 $, $Date: 2009-01-31 19:52:34 +1100 (Sat, 31 Jan 2009) $
+ */
+%%
+
+%final
+%public
+%class LexScan
+%implements sym, java_cup.runtime.Scanner
+%function next_token
+
+%type Symbol
+%unicode
+
+%column
+%line
+
+%eofclose
+
+%state COMMENT, STATELIST, MACROS, REGEXPSTART
+%state REGEXP, JAVA_CODE, STATES, STRING_CONTENT
+%state CHARCLASS, COPY, REPEATEXP, EATWSPNL
+%state CTOR_ARG
+
+%cupdebug
+
+%{
+ int balance = 0;
+ int commentbalance = 0;
+ int action_line = 0;
+ int bufferSize = 16384;
+
+ File file;
+ Stack files = new Stack();
+
+ StringBuffer userCode = new StringBuffer();
+
+ String classCode;
+ String initCode;
+ String initThrow;
+ String eofCode;
+ String eofThrow;
+ String lexThrow;
+ String eofVal;
+ String scanErrorException;
+ String cupSymbol = "sym";
+
+ StringBuffer actionText = new StringBuffer();
+ StringBuffer string = new StringBuffer();
+
+ boolean charCount;
+ boolean lineCount;
+ boolean columnCount;
+ boolean cupCompatible;
+ boolean cupDebug;
+ boolean isInteger;
+ boolean isIntWrap;
+ boolean isYYEOF;
+ boolean notUnix;
+ boolean isPublic;
+ boolean isFinal;
+ boolean isAbstract;
+ boolean bolUsed;
+ boolean standalone;
+ boolean debugOption;
+ boolean useRowMap = Options.gen_method == Options.PACK || Options.gen_method == Options.TABLE;
+ boolean packed = Options.gen_method == Options.PACK;
+ boolean caseless;
+ boolean inclusive_states;
+ boolean eofclose;
+
+ String isImplementing;
+ String isExtending;
+ String className = "Yylex";
+ String functionName;
+ String tokenType;
+ String visibility = "public";
+
+ Vector /* String */ ctorArgs = new Vector();
+ Vector /* String */ ctorTypes = new Vector();
+
+ LexicalStates states = new LexicalStates();
+
+ Vector actions = new Vector();
+
+ private int nextState;
+
+ boolean macroDefinition;
+
+ Timer t = new Timer();
+
+ public int currentLine() {
+ return yyline;
+ }
+
+ public void setFile(File file) {
+ this.file = file;
+ }
+
+ private Symbol symbol(int type, Object value) {
+ return new Symbol(type, yyline, yycolumn, value);
+ }
+
+ private Symbol symbol(int type) {
+ return new Symbol(type, yyline, yycolumn);
+ }
+
+ // updates line and column count to the beginning of the first
+ // non whitespace character in yytext, but leaves yyline+yycolumn
+ // untouched
+ private Symbol symbol_countUpdate(int type, Object value) {
+ int lc = yyline;
+ int cc = yycolumn;
+ String text = yytext();
+
+ for (int i=0; i < text.length(); i++) {
+ char c = text.charAt(i);
+
+ if (c != '\n' && c != '\r' && c != ' ' && c != '\t' )
+ return new Symbol(type, lc, cc, value);
+
+ if (c == '\n') {
+ lc++;
+ cc = 0;
+ }
+ else
+ cc++;
+ }
+
+ return new Symbol(type, yyline, yycolumn, value);
+ }
+
+ private String makeMacroIdent() {
+ String matched = yytext().trim();
+ return matched.substring(1, matched.length()-1).trim();
+ }
+
+ public static String conc(Object a, Object b) {
+ if (a == null && b == null) return null;
+ if (a == null) return b.toString();
+ if (b == null) return a.toString();
+
+ return a.toString()+b.toString();
+ }
+
+ public static String concExc(Object a, Object b) {
+ if (a == null && b == null) return null;
+ if (a == null) return b.toString();
+ if (b == null) return a.toString();
+
+ return a.toString()+", "+b.toString();
+ }
+%}
+
+%init{
+ states.insert("YYINITIAL", true);
+%init}
+
+
+Digit = [0-9]
+HexDigit = [0-9a-fA-F]
+OctDigit = [0-7]
+
+Number = {Digit}+
+HexNumber = \\ x {HexDigit} {2}
+Unicode = \\ u {HexDigit} {1, 4}
+OctNumber = \\ [0-3]? {OctDigit} {1, 2}
+
+// see http://www.unicode.org/unicode/reports/tr18/
+WSP = [ \t\b]
+WSPNL = [\u2028\u2029\u000A\u000B\u000C\u000D\u0085\t\b\ ]
+NL = [\u2028\u2029\u000A\u000B\u000C\u000D\u0085] | \u000D\u000A
+NNL = [^\u2028\u2029\u000A\u000B\u000C\u000D\u0085]
+
+Ident = {IdentStart} {IdentPart}*
+QualIdent = {Ident} ( {WSP}* "." {WSP}* {Ident} )*
+QUIL = {QualIdent} ( {WSP}* "," {WSP}* {QualIdent} )*
+Array = "[" {WSP}* "]"
+ParamPart = {IdentStart}|{IdentPart}|"<"|">"|","|{WSP}|"&"|"?"|"."
+GenParam = "<" {ParamPart}+ ">"
+ClassT = {Ident} ({WSP}* {GenParam})?
+QClassT = {QualIdent} ({WSP}* {GenParam})?
+ArrType = ({GenParam} {WSP}*)? {QClassT} ({WSP}* {Array})*
+
+IdentStart = [:jletter:]
+IdentPart = [:jletterdigit:]
+
+JFlexCommentChar = [^*/]|"/"+[^*/]|"*"+[^*/]
+JFlexComment = {JFlexCommentChar}*
+
+/* Java comments */
+JavaComment = {TraditionalComment}|{EndOfLineComment}
+TraditionalComment = "/*"{CommentContent}\*+"/"
+EndOfLineComment = "//".*{NL}
+
+CommentContent = ([^*]|\*+[^*/])*
+
+StringCharacter = [^\u2028\u2029\u000A\u000B\u000C\u000D\u0085\"\\]
+
+CharLiteral = \'([^\u2028\u2029\u000A\u000B\u000C\u000D\u0085\'\\]|{EscapeSequence})\'
+StringLiteral = \"({StringCharacter}|{EscapeSequence})*\"
+
+EscapeSequence = \\[^\u2028\u2029\u000A\u000B\u000C\u000D\u0085]|\\+u{HexDigit}{4}|\\[0-3]?{OctDigit}{1,2}
+
+/* \\(b|t|n|f|r|\"|\'|\\|[0-3]?{OctDigit}{1,2}|u{HexDigit}{4}) */
+
+JavaRest = [^\{\}\"\'/]|"/"[^*/]
+JavaCode = ({JavaRest}|{StringLiteral}|{CharLiteral}|{JavaComment})+
+
+%%
+
+ {
+ "%%".*{NL}? {
+ t.start();
+ yybegin(MACROS);
+ macroDefinition = true;
+ return symbol(USERCODE,userCode);
+ }
+ .*{NL} { userCode.append(yytext()); }
+ .* { return symbol(EOF); }
+}
+
+ ("%{"|"%init{"|"%initthrow{"|"%eof{"|"%eofthrow{"|"%yylexthrow{"|"%eofval{").*{NL}
+ { string.setLength(0); yybegin(COPY); }
+ {
+ "%}".*{NL} { classCode = conc(classCode,string); yybegin(MACROS); }
+ "%init}".*{NL} { initCode = conc(initCode,string); yybegin(MACROS); }
+ "%initthrow}".*{NL} { initThrow = concExc(initThrow,string); yybegin(MACROS); }
+ "%eof}".*{NL} { eofCode = conc(eofCode,string); yybegin(MACROS); }
+ "%eofthrow}".*{NL} { eofThrow = concExc(eofThrow,string); yybegin(MACROS); }
+ "%yylexthrow}".*{NL} { lexThrow = concExc(lexThrow,string); yybegin(MACROS); }
+ "%eofval}".*{NL} { eofVal = string.toString(); yybegin(MACROS); }
+
+ .*{NL} { string.append(yytext()); }
+
+ <> { throw new ScannerException(file,ErrorMessages.EOF_IN_MACROS); }
+}
+
+
+ ^"%s" ("tate" "s"?)? {WSP}+ { inclusive_states = true; yybegin(STATELIST); }
+ ^"%x" ("state" "s"?)? {WSP}+ { inclusive_states = false; yybegin(STATELIST); }
+ {
+ {Ident} { states.insert(yytext(),inclusive_states); }
+ ([\ \t]*","[\ \t]*)|([\ \t]+) { }
+ {NL} { yybegin(MACROS); }
+ <> { throw new ScannerException(file,ErrorMessages.EOF_IN_MACROS); }
+}
+
+ {
+ "%char" { charCount = true; }
+ "%line" { lineCount = true; }
+ "%column" { columnCount = true; }
+ "%byaccj" { isInteger = true;
+ if (eofVal == null)
+ eofVal = "return 0;";
+ eofclose = true;
+ }
+ "%cup" { cupCompatible = true;
+ isImplementing = concExc(isImplementing, "java_cup.runtime.Scanner");
+ if (functionName == null)
+ functionName = "next_token";
+ if (tokenType == null)
+ tokenType = "java_cup.runtime.Symbol";
+ if (eofVal == null)
+ eofVal = "return new java_cup.runtime.Symbol("+cupSymbol+".EOF);";
+ if (!Options.jlex) eofclose = true;
+ }
+ "%cupsym"{WSP}+{QualIdent} {WSP}* { cupSymbol = yytext().substring(8).trim();
+ if (cupCompatible) Out.warning(ErrorMessages.CUPSYM_AFTER_CUP, yyline); }
+ "%cupsym"{WSP}+{NNL}* { throw new ScannerException(file,ErrorMessages.QUIL_CUPSYM, yyline); }
+ "%cupdebug" { cupDebug = true; }
+ "%eofclose"({WSP}+"true")? { eofclose = true; }
+ "%eofclose"({WSP}+"false") { eofclose = false; }
+ "%class"{WSP}+{ClassT} {WSP}* { className = yytext().substring(7).trim(); }
+ "%ctorarg"{WSP}+{ArrType}{WSP}+ { yybegin(CTOR_ARG); ctorTypes.add(yytext().substring(8).trim()); }
+ "%function"{WSP}+{Ident} {WSP}* { functionName = yytext().substring(10).trim(); }
+ "%type"{WSP}+{ArrType} {WSP}* { tokenType = yytext().substring(6).trim(); }
+ "%integer"|"%int" { isInteger = true; }
+ "%intwrap" { isIntWrap = true; }
+ "%yyeof" { isYYEOF = true; }
+ "%notunix" { notUnix = true; }
+ "%7bit" { return symbol(ASCII); }
+ "%full"|"%8bit" { return symbol(FULL); }
+ "%unicode"|"%16bit" { return symbol(UNICODE); }
+ "%caseless"|"%ignorecase" { caseless = true; }
+ "%implements"{WSP}+.* { isImplementing = concExc(isImplementing, yytext().substring(12).trim()); }
+ "%extends"{WSP}+{QClassT}{WSP}* { isExtending = yytext().substring(9).trim(); }
+ "%public" { isPublic = true; }
+ "%apiprivate" { visibility = "private"; Skeleton.makePrivate(); }
+ "%final" { isFinal = true; }
+ "%abstract" { isAbstract = true; }
+ "%debug" { debugOption = true; }
+ "%standalone" { standalone = true; isInteger = true; }
+ "%switch" { packed = false; useRowMap = false; }
+ "%table" { packed = false; useRowMap = true; }
+ "%pack" { packed = true; useRowMap = true; }
+ "%include" {WSP}+ .* { File f = new File(yytext().substring(9).trim());
+ if ( !f.canRead() )
+ throw new ScannerException(file,ErrorMessages.NOT_READABLE, yyline);
+ // check for cycle
+ if (files.search(f) > 0)
+ throw new ScannerException(file,ErrorMessages.FILE_CYCLE, yyline);
+ try {
+ yypushStream( new FileReader(f) );
+ files.push(file);
+ file = f;
+ Out.println("Including \""+file+"\"");
+ }
+ catch (FileNotFoundException e) {
+ throw new ScannerException(file,ErrorMessages.NOT_READABLE, yyline);
+ }
+ }
+ "%buffer" {WSP}+ {Number} {WSP}* { bufferSize = Integer.parseInt(yytext().substring(8).trim()); }
+ "%buffer" {WSP}+ {NNL}* { throw new ScannerException(file,ErrorMessages.NO_BUFFER_SIZE, yyline); }
+ "%initthrow" {WSP}+ {QUIL} {WSP}* { initThrow = concExc(initThrow,yytext().substring(11).trim()); }
+ "%initthrow" {WSP}+ {NNL}* { throw new ScannerException(file,ErrorMessages.QUIL_INITTHROW, yyline); }
+ "%eofthrow" {WSP}+ {QUIL} {WSP}* { eofThrow = concExc(eofThrow,yytext().substring(10).trim()); }
+ "%eofthrow" {WSP}+ {NNL}* { throw new ScannerException(file,ErrorMessages.QUIL_EOFTHROW, yyline); }
+ "%yylexthrow"{WSP}+ {QUIL} {WSP}* { lexThrow = concExc(lexThrow,yytext().substring(12).trim()); }
+ "%throws" {WSP}+ {QUIL} {WSP}* { lexThrow = concExc(lexThrow,yytext().substring(8).trim()); }
+ "%yylexthrow"{WSP}+ {NNL}* { throw new ScannerException(file,ErrorMessages.QUIL_YYLEXTHROW, yyline); }
+ "%throws" {WSP}+ {NNL}* { throw new ScannerException(file,ErrorMessages.QUIL_THROW, yyline); }
+ "%scanerror" {WSP}+ {QualIdent} {WSP}* { scanErrorException = yytext().substring(11).trim(); }
+ "%scanerror" {WSP}+ {NNL}* { throw new ScannerException(file,ErrorMessages.QUIL_SCANERROR, yyline); }
+
+ {Ident} { return symbol(IDENT, yytext()); }
+ "="{WSP}* { yybegin(REGEXP); return symbol(EQUALS); }
+
+ "/*" { nextState = MACROS; yybegin(COMMENT); }
+
+ {EndOfLineComment} { }
+
+ /* no {NL} at the end of this expression, because
+ needs at least one {WSPNL} to start a regular expression! */
+ ^"%%" {NNL}* { macroDefinition = false; yybegin(REGEXPSTART); return symbol(DELIMITER); }
+ "%"{Ident} { throw new ScannerException(file,ErrorMessages.UNKNOWN_OPTION, yyline, yycolumn); }
+ "%" { throw new ScannerException(file,ErrorMessages.UNKNOWN_OPTION, yyline, yycolumn); }
+ ^{WSP}+"%" { Out.warning(ErrorMessages.NOT_AT_BOL, yyline); yypushback(1); }
+
+ {WSP}+ { }
+ {NL}+ { }
+ <> { if ( yymoreStreams() ) {
+ file = (File) files.pop();
+ yypopStream();
+ }
+ else
+ throw new ScannerException(file,ErrorMessages.EOF_IN_MACROS);
+ }
+}
+
+ {
+ {Ident} {WSP}* { yybegin(MACROS); ctorArgs.add(yytext().trim()); }
+ [^] { throw new ScannerException(file,ErrorMessages.CTOR_ARG,yyline,yycolumn); }
+}
+
+ {
+ {WSPNL}* "/*" { nextState = REGEXPSTART; yybegin(COMMENT); }
+ {WSPNL}+ { yybegin(REGEXP); }
+ {WSPNL}* "<" { yybegin(STATES); return symbol_countUpdate(LESSTHAN, null); }
+ {WSPNL}* "}" { return symbol_countUpdate(RBRACE, null); }
+ {WSPNL}* "//" {NNL}* { }
+ {WSPNL}* "<>" {WSPNL}* "{"
+ { actionText.setLength(0); yybegin(JAVA_CODE);
+ Symbol s = symbol_countUpdate(EOFRULE, null);
+ action_line = s.left+1;
+ return s;
+ }
+}
+
+ {
+ {Ident} { return symbol(IDENT, yytext()); }
+ "," { return symbol(COMMA); }
+ {WSPNL}+ { }
+
+ // "{" will be caught in REGEXP
+ ">"{WSPNL}* { yybegin(REGEXP); return symbol(MORETHAN); }
+
+ <> { throw new ScannerException(file,ErrorMessages.EOF_IN_STATES); }
+}
+
+
+ {
+ "<>" {WSPNL}+ "{" { actionText.setLength(0); yybegin(JAVA_CODE); action_line = yyline+1; return symbol(EOFRULE); }
+ "<>" { throw new ScannerException(file,ErrorMessages.EOF_WO_ACTION); }
+
+ {WSPNL}*"|"{WSP}*$ { if (macroDefinition) {
+ yybegin(EATWSPNL);
+ return symbol(BAR);
+ }
+ else {
+ yybegin(REGEXPSTART);
+ return symbol(NOACTION);
+ }
+ }
+
+ // stategroup
+ "{" { yybegin(REGEXPSTART); return symbol(LBRACE); }
+
+ {WSPNL}*"|" { return symbol(BAR); }
+
+ {WSPNL}*\" { string.setLength(0); nextState = REGEXP; yybegin(STRING_CONTENT); }
+ {WSPNL}*"!" { return symbol(BANG); }
+ {WSPNL}*"~" { return symbol(TILDE); }
+ {WSPNL}*"(" { return symbol(OPENBRACKET); }
+ {WSPNL}*")" { return symbol(CLOSEBRACKET); }
+ {WSPNL}*"*" { return symbol(STAR); }
+ {WSPNL}*"+" { return symbol(PLUS); }
+ {WSPNL}*"?" { return symbol(QUESTION); }
+ {WSPNL}*"$" { return symbol(DOLLAR); }
+ {WSPNL}*"^" { bolUsed = true; return symbol(HAT); }
+ {WSPNL}*"." { return symbol(POINT); }
+ {WSPNL}*"[" { yybegin(CHARCLASS); return symbol(OPENCLASS); }
+ {WSPNL}*"/" { return symbol(LOOKAHEAD); }
+
+ {WSPNL}* "{" {WSP}* {Ident} {WSP}* "}" { return symbol_countUpdate(MACROUSE, makeMacroIdent()); }
+ {WSPNL}* "{" {WSP}* {Number} { yybegin(REPEATEXP); return symbol(REPEAT, new Integer(yytext().trim().substring(1).trim())); }
+
+ {WSPNL}+ "{" { actionText.setLength(0); yybegin(JAVA_CODE); action_line = yyline+1; return symbol(REGEXPEND); }
+ {NL} { if (macroDefinition) { yybegin(MACROS); } return symbol(REGEXPEND); }
+
+ {WSPNL}*"/*" { nextState = REGEXP; yybegin(COMMENT); }
+
+ {WSPNL}*"//"{NNL}* { }
+
+ {WSP}+ { }
+
+ {
+ {WSPNL}*"[:jletter:]" { return symbol(JLETTERCLASS); }
+ {WSPNL}*"[:jletterdigit:]" { return symbol(JLETTERDIGITCLASS); }
+ {WSPNL}*"[:letter:]" { return symbol(LETTERCLASS); }
+ {WSPNL}*"[:digit:]" { return symbol(DIGITCLASS); }
+ {WSPNL}*"[:uppercase:]" { return symbol(UPPERCLASS); }
+ {WSPNL}*"[:lowercase:]" { return symbol(LOWERCLASS); }
+ }
+
+ . { return symbol(CHAR, new Character(yytext().charAt(0))); }
+}
+
+ {WSPNL}+ { yybegin(REGEXP); }
+
+
+ {
+ "}" { yybegin(REGEXP); return symbol(RBRACE); }
+ "," {WSP}* {Number} { return symbol(REPEAT, new Integer(yytext().substring(1).trim())); }
+ {WSP}+ { }
+
+ <> { throw new ScannerException(file,ErrorMessages.EOF_IN_REGEXP); }
+}
+
+ {
+ "{"{Ident}"}" { return symbol(MACROUSE, yytext().substring(1,yytext().length()-1)); }
+ "[" { balance++; return symbol(OPENCLASS); }
+ "]" { if (balance > 0) balance--; else yybegin(REGEXP); return symbol(CLOSECLASS); }
+ "^" { return symbol(HAT); }
+ "-" { return symbol(DASH); }
+
+ // this is a hack to keep JLex compatibilty with char class
+ // expressions like [+-]
+ "-]" { yypushback(1); yycolumn--; return symbol(CHAR, new Character(yytext().charAt(0))); }
+
+ \" { string.setLength(0); nextState = CHARCLASS; yybegin(STRING_CONTENT); }
+
+ . { return symbol(CHAR, new Character(yytext().charAt(0))); }
+
+ \n { throw new ScannerException(file,ErrorMessages.EOL_IN_CHARCLASS,yyline,yycolumn); }
+
+ <> { throw new ScannerException(file,ErrorMessages.EOF_IN_REGEXP); }
+}
+
+ {
+ \" { yybegin(nextState); return symbol(STRING, string.toString()); }
+ \\\" { string.append('\"'); }
+ [^\"\\\u2028\u2029\u000A\u000B\u000C\u000D\u0085]+ { string.append(yytext()); }
+
+ {NL} { throw new ScannerException(file,ErrorMessages.UNTERMINATED_STR, yyline, yycolumn); }
+
+ {HexNumber} { string.append( (char) Integer.parseInt(yytext().substring(2,yytext().length()), 16)); }
+ {Unicode} { string.append( (char) Integer.parseInt(yytext().substring(2,yytext().length()), 16)); }
+ {OctNumber} { string.append( (char) Integer.parseInt(yytext().substring(1,yytext().length()), 8)); }
+
+ \\b { string.append('\b'); }
+ \\n { string.append('\n'); }
+ \\t { string.append('\t'); }
+ \\f { string.append('\f'); }
+ \\r { string.append('\r'); }
+
+ \\. { string.append(yytext().charAt(1)); }
+
+ <> { throw new ScannerException(file,ErrorMessages.EOF_IN_STRING); }
+}
+
+
+ {
+ {HexNumber} { return symbol(CHAR, new Character( (char) Integer.parseInt(yytext().substring(2,yytext().length()), 16))); }
+ {Unicode} { return symbol(CHAR, new Character( (char) Integer.parseInt(yytext().substring(2,yytext().length()), 16))); }
+ {OctNumber} { return symbol(CHAR, new Character( (char) Integer.parseInt(yytext().substring(1,yytext().length()), 8))); }
+
+ \\b { return symbol(CHAR,new Character('\b')); }
+ \\n { return symbol(CHAR,new Character('\n')); }
+ \\t { return symbol(CHAR,new Character('\t')); }
+ \\f { return symbol(CHAR,new Character('\f')); }
+ \\r { return symbol(CHAR,new Character('\r')); }
+
+ \\. { return symbol(CHAR, new Character(yytext().charAt(1))); }
+}
+
+
+ {
+ "{" { balance++; actionText.append('{'); }
+ "}" { if (balance > 0) {
+ balance--;
+ actionText.append('}');
+ }
+ else {
+ yybegin(REGEXPSTART);
+ Action a = new Action(actionText.toString(), action_line);
+ actions.addElement(a);
+ return symbol(ACTION, a);
+ }
+ }
+
+ {JavaCode} { actionText.append(yytext()); }
+
+ <> { throw new ScannerException(file,ErrorMessages.EOF_IN_ACTION, action_line-1); }
+}
+
+ {
+
+ "/"+ "*" { commentbalance++; }
+ "*"+ "/" { if (commentbalance > 0)
+ commentbalance--;
+ else
+ yybegin(nextState);
+ }
+
+ {JFlexComment} { /* ignore */ }
+
+ <> { throw new ScannerException(file,ErrorMessages.EOF_IN_COMMENT); }
+}
+
+
+. { throw new ScannerException(file,ErrorMessages.UNEXPECTED_CHAR, yyline, yycolumn); }
+\n { throw new ScannerException(file,ErrorMessages.UNEXPECTED_NL, yyline, yycolumn); }
+
+<> { if ( yymoreStreams() ) {
+ file = (File) files.pop();
+ yypopStream();
+ }
+ else
+ return symbol(EOF); }
Index: /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/src/JFlex/LexScan.java
===================================================================
--- /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/src/JFlex/LexScan.java (revision 25585)
+++ /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/src/JFlex/LexScan.java (revision 25585)
@@ -0,0 +1,3012 @@
+/* The following code was generated by JFlex 1.4.3 on 1/31/09 11:52 PM */
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * JFlex 1.4.3 *
+ * Copyright (C) 1998-2009 Gerwin Klein *
+ * All rights reserved. *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License. See the file *
+ * COPYRIGHT for more information. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License along *
+ * with this program; if not, write to the Free Software Foundation, Inc., *
+ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *
+ * *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+package JFlex;
+
+import java_cup.runtime.Symbol;
+import java.util.Vector;
+import java.io.*;
+import java.util.Stack;
+
+/**
+ * The lexer of JFlex.
+ *
+ * Generated by JFlex.
+ *
+ * @author Gerwin Klein
+ * @version JFlex 1.4.3, $Revision: 433 $, $Date: 2009-01-31 19:52:34 +1100 (Sat, 31 Jan 2009) $
+ */
+
+public final class LexScan implements sym, java_cup.runtime.Scanner {
+
+ /** This character denotes the end of file */
+ public static final int YYEOF = -1;
+
+ /** initial size of the lookahead buffer */
+ private static final int ZZ_BUFFERSIZE = 16384;
+
+ /** lexical states */
+ public static final int STRING_CONTENT = 16;
+ public static final int REGEXPSTART = 8;
+ public static final int MACROS = 6;
+ public static final int STATELIST = 4;
+ public static final int CTOR_ARG = 26;
+ public static final int EATWSPNL = 24;
+ public static final int CHARCLASS = 18;
+ public static final int JAVA_CODE = 12;
+ public static final int REGEXP = 10;
+ public static final int YYINITIAL = 0;
+ public static final int REPEATEXP = 22;
+ public static final int COMMENT = 2;
+ public static final int STATES = 14;
+ public static final int COPY = 20;
+
+ /**
+ * ZZ_LEXSTATE[l] is the state in the DFA for the lexical state l
+ * ZZ_LEXSTATE[l+1] is the state in the DFA for the lexical state l
+ * at the beginning of a line
+ * l is of the form l = 2*k, k a non negative integer
+ */
+ private static final int ZZ_LEXSTATE[] = {
+ 0, 0, 1, 1, 2, 2, 3, 4, 5, 5, 6, 6, 7, 7, 8, 8,
+ 9, 9, 10, 10, 11, 11, 12, 12, 13, 13, 14, 14
+ };
+
+ /**
+ * Translates characters to character classes
+ */
+ private static final String ZZ_CMAP_PACKED =
+ "\10\25\1\26\1\10\1\13\2\11\1\12\16\25\4\0\1\10\1\76"+
+ "\1\32\1\0\1\103\1\35\1\22\1\33\1\100\1\101\1\30\1\102"+
+ "\1\15\1\106\1\14\1\31\1\7\1\66\2\7\2\3\1\67\1\64"+
+ "\1\65\1\1\1\105\1\0\1\20\1\71\1\21\1\23\1\0\4\2"+
+ "\1\72\1\74\10\24\1\73\13\24\1\16\1\4\1\17\1\104\1\24"+
+ "\1\0\1\53\1\57\1\55\1\62\1\46\1\47\1\63\1\42\1\37"+
+ "\1\60\1\70\1\51\1\56\1\40\1\44\1\61\1\24\1\43\1\54"+
+ "\1\41\1\6\1\52\1\45\1\5\1\50\1\24\1\36\1\75\1\34"+
+ "\1\77\6\25\1\27\32\25\2\0\4\24\4\0\1\24\2\0\1\25"+
+ "\7\0\1\24\4\0\1\24\5\0\27\24\1\0\37\24\1\0\u013f\24"+
+ "\31\0\162\24\4\0\14\24\16\0\5\24\11\0\1\24\21\0\130\25"+
+ "\5\0\23\25\12\0\1\24\13\0\1\24\1\0\3\24\1\0\1\24"+
+ "\1\0\24\24\1\0\54\24\1\0\46\24\1\0\5\24\4\0\202\24"+
+ "\1\0\4\25\3\0\105\24\1\0\46\24\2\0\2\24\6\0\20\24"+
+ "\41\0\46\24\2\0\1\24\7\0\47\24\11\0\21\25\1\0\27\25"+
+ "\1\0\3\25\1\0\1\25\1\0\2\25\1\0\1\25\13\0\33\24"+
+ "\5\0\3\24\15\0\4\25\14\0\6\25\13\0\32\24\5\0\13\24"+
+ "\16\25\7\0\12\25\4\0\2\24\1\25\143\24\1\0\1\24\10\25"+
+ "\1\0\6\25\2\24\2\25\1\0\4\25\2\24\12\25\3\24\2\0"+
+ "\1\24\17\0\1\25\1\24\1\25\36\24\33\25\2\0\3\24\60\0"+
+ "\46\24\13\25\1\24\u014f\0\3\25\66\24\2\0\1\25\1\24\20\25"+
+ "\2\0\1\24\4\25\3\0\12\24\2\25\2\0\12\25\21\0\3\25"+
+ "\1\0\10\24\2\0\2\24\2\0\26\24\1\0\7\24\1\0\1\24"+
+ "\3\0\4\24\2\0\1\25\1\24\7\25\2\0\2\25\2\0\3\25"+
+ "\11\0\1\25\4\0\2\24\1\0\3\24\2\25\2\0\12\25\4\24"+
+ "\15\0\3\25\1\0\6\24\4\0\2\24\2\0\26\24\1\0\7\24"+
+ "\1\0\2\24\1\0\2\24\1\0\2\24\2\0\1\25\1\0\5\25"+
+ "\4\0\2\25\2\0\3\25\13\0\4\24\1\0\1\24\7\0\14\25"+
+ "\3\24\14\0\3\25\1\0\11\24\1\0\3\24\1\0\26\24\1\0"+
+ "\7\24\1\0\2\24\1\0\5\24\2\0\1\25\1\24\10\25\1\0"+
+ "\3\25\1\0\3\25\2\0\1\24\17\0\2\24\2\25\2\0\12\25"+
+ "\1\0\1\24\17\0\3\25\1\0\10\24\2\0\2\24\2\0\26\24"+
+ "\1\0\7\24\1\0\2\24\1\0\5\24\2\0\1\25\1\24\6\25"+
+ "\3\0\2\25\2\0\3\25\10\0\2\25\4\0\2\24\1\0\3\24"+
+ "\4\0\12\25\1\0\1\24\20\0\1\25\1\24\1\0\6\24\3\0"+
+ "\3\24\1\0\4\24\3\0\2\24\1\0\1\24\1\0\2\24\3\0"+
+ "\2\24\3\0\3\24\3\0\10\24\1\0\3\24\4\0\5\25\3\0"+
+ "\3\25\1\0\4\25\11\0\1\25\17\0\11\25\11\0\1\24\7\0"+
+ "\3\25\1\0\10\24\1\0\3\24\1\0\27\24\1\0\12\24\1\0"+
+ "\5\24\4\0\7\25\1\0\3\25\1\0\4\25\7\0\2\25\11\0"+
+ "\2\24\4\0\12\25\22\0\2\25\1\0\10\24\1\0\3\24\1\0"+
+ "\27\24\1\0\12\24\1\0\5\24\2\0\1\25\1\24\7\25\1\0"+
+ "\3\25\1\0\4\25\7\0\2\25\7\0\1\24\1\0\2\24\4\0"+
+ "\12\25\22\0\2\25\1\0\10\24\1\0\3\24\1\0\27\24\1\0"+
+ "\20\24\4\0\6\25\2\0\3\25\1\0\4\25\11\0\1\25\10\0"+
+ "\2\24\4\0\12\25\22\0\2\25\1\0\22\24\3\0\30\24\1\0"+
+ "\11\24\1\0\1\24\2\0\7\24\3\0\1\25\4\0\6\25\1\0"+
+ "\1\25\1\0\10\25\22\0\2\25\15\0\60\24\1\25\2\24\7\25"+
+ "\4\0\10\24\10\25\1\0\12\25\47\0\2\24\1\0\1\24\2\0"+
+ "\2\24\1\0\1\24\2\0\1\24\6\0\4\24\1\0\7\24\1\0"+
+ "\3\24\1\0\1\24\1\0\1\24\2\0\2\24\1\0\4\24\1\25"+
+ "\2\24\6\25\1\0\2\25\1\24\2\0\5\24\1\0\1\24\1\0"+
+ "\6\25\2\0\12\25\2\0\2\24\42\0\1\24\27\0\2\25\6\0"+
+ "\12\25\13\0\1\25\1\0\1\25\1\0\1\25\4\0\2\25\10\24"+
+ "\1\0\42\24\6\0\24\25\1\0\2\25\4\24\4\0\10\25\1\0"+
+ "\44\25\11\0\1\25\71\0\42\24\1\0\5\24\1\0\2\24\1\0"+
+ "\7\25\3\0\4\25\6\0\12\25\6\0\6\24\4\25\106\0\46\24"+
+ "\12\0\51\24\7\0\132\24\5\0\104\24\5\0\122\24\6\0\7\24"+
+ "\1\0\77\24\1\0\1\24\1\0\4\24\2\0\7\24\1\0\1\24"+
+ "\1\0\4\24\2\0\47\24\1\0\1\24\1\0\4\24\2\0\37\24"+
+ "\1\0\1\24\1\0\4\24\2\0\7\24\1\0\1\24\1\0\4\24"+
+ "\2\0\7\24\1\0\7\24\1\0\27\24\1\0\37\24\1\0\1\24"+
+ "\1\0\4\24\2\0\7\24\1\0\47\24\1\0\23\24\16\0\11\25"+
+ "\56\0\125\24\14\0\u026c\24\2\0\10\24\12\0\32\24\5\0\113\24"+
+ "\3\0\3\24\17\0\15\24\1\0\4\24\3\25\13\0\22\24\3\25"+
+ "\13\0\22\24\2\25\14\0\15\24\1\0\3\24\1\0\2\25\14\0"+
+ "\64\24\40\25\3\0\1\24\3\0\2\24\1\25\2\0\12\25\41\0"+
+ "\3\25\2\0\12\25\6\0\130\24\10\0\51\24\1\25\126\0\35\24"+
+ "\3\0\14\25\4\0\14\25\12\0\12\25\36\24\2\0\5\24\u038b\0"+
+ "\154\24\224\0\234\24\4\0\132\24\6\0\26\24\2\0\6\24\2\0"+
+ "\46\24\2\0\6\24\2\0\10\24\1\0\1\24\1\0\1\24\1\0"+
+ "\1\24\1\0\37\24\2\0\65\24\1\0\7\24\1\0\1\24\3\0"+
+ "\3\24\1\0\7\24\3\0\4\24\2\0\6\24\4\0\15\24\5\0"+
+ "\3\24\1\0\7\24\17\0\4\25\30\0\2\11\5\25\20\0\2\24"+
+ "\23\0\1\24\13\0\4\25\6\0\6\25\1\0\1\24\15\0\1\24"+
+ "\40\0\22\24\36\0\15\25\4\0\1\25\3\0\6\25\27\0\1\24"+
+ "\4\0\1\24\2\0\12\24\1\0\1\24\3\0\5\24\6\0\1\24"+
+ "\1\0\1\24\1\0\1\24\1\0\4\24\1\0\3\24\1\0\7\24"+
+ "\3\0\3\24\5\0\5\24\26\0\44\24\u0e81\0\3\24\31\0\11\24"+
+ "\6\25\1\0\5\24\2\0\5\24\4\0\126\24\2\0\2\25\2\0"+
+ "\3\24\1\0\137\24\5\0\50\24\4\0\136\24\21\0\30\24\70\0"+
+ "\20\24\u0200\0\u19b6\24\112\0\u51a6\24\132\0\u048d\24\u0773\0\u2ba4\24\u215c\0"+
+ "\u012e\24\2\0\73\24\225\0\7\24\14\0\5\24\5\0\1\24\1\25"+
+ "\12\24\1\0\15\24\1\0\5\24\1\0\1\24\1\0\2\24\1\0"+
+ "\2\24\1\0\154\24\41\0\u016b\24\22\0\100\24\2\0\66\24\50\0"+
+ "\15\24\3\0\20\25\20\0\4\25\17\0\2\24\30\0\3\24\31\0"+
+ "\1\24\6\0\5\24\1\0\207\24\2\0\1\25\4\0\1\24\13\0"+
+ "\12\25\7\0\32\24\4\0\1\24\1\0\32\24\12\0\132\24\3\0"+
+ "\6\24\2\0\6\24\2\0\6\24\2\0\3\24\3\0\2\24\3\0"+
+ "\2\24\22\0\3\25\4\0";
+
+ /**
+ * Translates characters to character classes
+ */
+ private static final char [] ZZ_CMAP = zzUnpackCMap(ZZ_CMAP_PACKED);
+
+ /**
+ * Translates DFA states to action switch labels.
+ */
+ private static final int [] ZZ_ACTION = zzUnpackAction();
+
+ private static final String ZZ_ACTION_PACKED_0 =
+ "\1\1\1\2\15\0\1\1\2\3\1\1\1\2\3\4"+
+ "\1\5\1\6\2\7\1\6\1\10\2\6\1\4\1\11"+
+ "\1\12\1\6\1\11\1\13\1\14\1\4\1\15\2\16"+
+ "\1\6\2\17\1\20\1\21\1\16\1\22\1\23\1\24"+
+ "\1\25\1\26\1\27\1\30\1\31\1\32\1\33\1\34"+
+ "\1\35\1\36\1\37\3\4\1\40\1\41\1\6\1\42"+
+ "\1\43\1\44\1\4\2\45\1\46\1\16\1\47\1\50"+
+ "\1\51\1\52\1\16\1\53\1\54\1\4\2\44\1\4"+
+ "\1\55\1\4\1\56\1\13\1\57\1\60\1\61\3\0"+
+ "\1\62\1\63\1\0\1\64\1\0\2\11\1\0\15\11"+
+ "\3\0\1\65\1\11\1\66\1\11\2\0\1\67\1\6"+
+ "\1\70\1\71\2\70\1\71\1\72\1\73\1\74\1\75"+
+ "\1\76\1\0\1\77\2\0\1\100\1\101\3\0\2\102"+
+ "\10\0\1\103\1\104\2\103\1\104\1\105\1\106\1\107"+
+ "\1\110\1\111\1\112\3\0\1\113\5\0\1\114\1\0"+
+ "\1\60\1\61\2\6\1\11\2\115\35\11\3\0\2\116"+
+ "\1\11\2\117\1\11\1\0\1\71\1\0\1\120\6\0"+
+ "\1\121\1\122\1\0\1\37\4\0\1\104\1\0\1\123"+
+ "\1\124\2\125\3\0\2\11\1\126\24\11\1\127\12\11"+
+ "\3\0\2\11\1\0\2\120\14\0\2\123\3\0\20\11"+
+ "\1\130\3\11\1\131\10\11\1\132\6\11\1\133\1\11"+
+ "\1\134\1\130\1\0\2\11\1\0\1\120\13\0\1\123"+
+ "\5\0\11\11\1\0\1\11\1\135\5\11\1\136\1\137"+
+ "\17\11\1\140\1\141\2\11\7\0\2\37\10\0\2\142"+
+ "\3\0\11\11\1\143\1\0\11\11\1\144\4\11\1\145"+
+ "\1\0\3\11\1\146\1\147\2\11\6\0\1\150\1\37"+
+ "\3\0\1\37\6\0\2\151\4\0\1\141\1\11\1\152"+
+ "\1\126\3\11\1\153\2\154\1\143\4\0\11\11\2\155"+
+ "\2\11\1\156\1\11\2\157\1\11\1\160\6\0\1\37"+
+ "\6\0\1\37\13\0\1\11\1\161\2\11\1\154\1\162"+
+ "\1\154\1\143\3\0\2\11\1\163\2\11\1\164\3\11"+
+ "\1\155\1\165\1\155\1\166\1\0\1\11\1\156\1\0"+
+ "\1\167\1\157\2\170\1\157\4\0\1\171\1\172\2\37"+
+ "\4\0\2\37\7\0\2\173\1\0\3\11\2\162\2\143"+
+ "\1\174\2\175\1\0\1\11\1\0\5\11\2\165\2\0"+
+ "\1\11\1\0\2\170\2\0\1\176\2\0\1\37\2\0"+
+ "\2\37\4\0\1\37\2\0\2\37\7\0\2\177\1\11"+
+ "\1\162\1\0\1\143\1\0\1\174\1\0\1\175\1\200"+
+ "\1\175\2\0\2\11\1\201\1\11\1\202\1\203\2\204"+
+ "\1\165\1\0\1\205\3\0\1\205\1\0\1\205\1\156"+
+ "\3\0\1\206\1\0\4\37\3\0\4\37\3\0\2\207"+
+ "\1\0\1\177\1\210\1\177\1\211\3\0\2\200\2\0"+
+ "\2\11\1\201\2\212\1\204\1\213\1\204\12\0\3\37"+
+ "\5\0\3\37\1\0\2\214\1\0\2\210\2\143\1\174"+
+ "\1\200\3\0\2\11\1\212\1\215\1\212\2\213\1\205"+
+ "\2\0\1\216\1\217\4\0\1\37\3\0\1\37\2\220"+
+ "\1\210\1\0\1\143\1\163\1\0\1\163\1\11\2\215"+
+ "\1\213\1\0\2\205\1\0\1\205\3\0\1\37\2\0"+
+ "\1\37\2\221\1\215\10\0\1\222\3\205";
+
+ private static int [] zzUnpackAction() {
+ int [] result = new int[826];
+ int offset = 0;
+ offset = zzUnpackAction(ZZ_ACTION_PACKED_0, offset, result);
+ return result;
+ }
+
+ private static int zzUnpackAction(String packed, int offset, int [] result) {
+ int i = 0; /* index in packed string */
+ int j = offset; /* index in unpacked array */
+ int l = packed.length();
+ while (i < l) {
+ int count = packed.charAt(i++);
+ int value = packed.charAt(i++);
+ do result[j++] = value; while (--count > 0);
+ }
+ return j;
+ }
+
+
+ /**
+ * Translates a state to a row index in the transition table
+ */
+ private static final int [] ZZ_ROWMAP = zzUnpackRowMap();
+
+ private static final String ZZ_ROWMAP_PACKED_0 =
+ "\0\0\0\107\0\216\0\325\0\u011c\0\u0163\0\u01aa\0\u01f1"+
+ "\0\u0238\0\u027f\0\u02c6\0\u030d\0\u0354\0\u039b\0\u03e2\0\u0429"+
+ "\0\u0429\0\u0470\0\u04b7\0\u04fe\0\u0545\0\u058c\0\u0470\0\u05d3"+
+ "\0\u061a\0\u0470\0\u0661\0\u06a8\0\u06ef\0\u0736\0\u077d\0\u07c4"+
+ "\0\u080b\0\u0852\0\u0899\0\u08e0\0\u0927\0\u096e\0\u09b5\0\u0470"+
+ "\0\u0470\0\u09fc\0\u0a43\0\u0a8a\0\u0ad1\0\u0470\0\u0b18\0\u0b5f"+
+ "\0\u0470\0\u0470\0\u0ba6\0\u0470\0\u0bed\0\u0c34\0\u0470\0\u0470"+
+ "\0\u0470\0\u0470\0\u0470\0\u0470\0\u0470\0\u0c7b\0\u0cc2\0\u0d09"+
+ "\0\u0d50\0\u0470\0\u0470\0\u0d97\0\u0470\0\u0dde\0\u0e25\0\u0e6c"+
+ "\0\u0470\0\u0eb3\0\u0470\0\u0efa\0\u0efa\0\u0b18\0\u0470\0\u0470"+
+ "\0\u0f41\0\u0470\0\u0f88\0\u0fcf\0\u0fcf\0\u0470\0\u1016\0\u0470"+
+ "\0\u105d\0\u0470\0\u10a4\0\u0470\0\u10eb\0\u1132\0\u1179\0\u11c0"+
+ "\0\u0545\0\u0470\0\u0470\0\u058c\0\u0470\0\u1207\0\u124e\0\u1295"+
+ "\0\u12dc\0\u1323\0\u136a\0\u13b1\0\u13f8\0\u143f\0\u1486\0\u14cd"+
+ "\0\u1514\0\u155b\0\u15a2\0\u15e9\0\u1630\0\u1677\0\u16be\0\u1705"+
+ "\0\u174c\0\u0470\0\u1793\0\u17da\0\u1821\0\u09b5\0\u1868\0\u0470"+
+ "\0\u18af\0\u0470\0\u18f6\0\u193d\0\u1984\0\u19cb\0\u0470\0\u0470"+
+ "\0\u0470\0\u0470\0\u0470\0\u0a8a\0\u0bed\0\u1a12\0\u1a59\0\u0470"+
+ "\0\u1aa0\0\u1ae7\0\u0bed\0\u0c34\0\u0470\0\u1b2e\0\u0cc2\0\u0d09"+
+ "\0\u0d50\0\u1b75\0\u1bbc\0\u1c03\0\u1c4a\0\u1c91\0\u0470\0\u1cd8"+
+ "\0\u1d1f\0\u1d66\0\u1dad\0\u0470\0\u0470\0\u0470\0\u0470\0\u0470"+
+ "\0\u0470\0\u0efa\0\u0b18\0\u1df4\0\u0470\0\u0fcf\0\u1e3b\0\u1e82"+
+ "\0\u1ec9\0\u1f10\0\u1f57\0\u105d\0\u1f9e\0\u0470\0\u1207\0\u0470"+
+ "\0\u1fe5\0\u12dc\0\u0470\0\u202c\0\u2073\0\u20ba\0\u2101\0\u2148"+
+ "\0\u218f\0\u21d6\0\u221d\0\u2264\0\u22ab\0\u22f2\0\u2339\0\u2380"+
+ "\0\u23c7\0\u240e\0\u2455\0\u249c\0\u24e3\0\u252a\0\u2571\0\u25b8"+
+ "\0\u25ff\0\u2646\0\u268d\0\u26d4\0\u271b\0\u2762\0\u27a9\0\u27f0"+
+ "\0\u2837\0\u287e\0\u28c5\0\u290c\0\u2953\0\u299a\0\u29e1\0\u2a28"+
+ "\0\u2a6f\0\u2ab6\0\u0470\0\u2afd\0\u2b44\0\u2b8b\0\u2bd2\0\u2c19"+
+ "\0\u2c60\0\u2ca7\0\u2cee\0\u0470\0\u0470\0\u2d35\0\u2d7c\0\u2dc3"+
+ "\0\u2e0a\0\u2e51\0\u2e98\0\u0470\0\u2edf\0\u2f26\0\u0470\0\u1e3b"+
+ "\0\u0470\0\u2f6d\0\u2fb4\0\u2ffb\0\u3042\0\u3089\0\u30d0\0\u3117"+
+ "\0\u315e\0\u31a5\0\u31ec\0\u3233\0\u327a\0\u32c1\0\u3308\0\u334f"+
+ "\0\u3396\0\u33dd\0\u3424\0\u346b\0\u34b2\0\u34f9\0\u3540\0\u3587"+
+ "\0\u35ce\0\u3615\0\u365c\0\u36a3\0\u36ea\0\u3731\0\u3778\0\u37bf"+
+ "\0\u3806\0\u384d\0\u3894\0\u38db\0\u3922\0\u3969\0\u39b0\0\u39f7"+
+ "\0\u3a3e\0\u3a85\0\u3acc\0\u3b13\0\u0470\0\u3b5a\0\u3ba1\0\u3be8"+
+ "\0\u3c2f\0\u3c76\0\u3cbd\0\u3d04\0\u3d4b\0\u3d92\0\u3dd9\0\u3e20"+
+ "\0\u3e67\0\u3eae\0\u0470\0\u3ef5\0\u3f3c\0\u3f83\0\u3fca\0\u4011"+
+ "\0\u4058\0\u409f\0\u40e6\0\u412d\0\u4174\0\u41bb\0\u4202\0\u4249"+
+ "\0\u4290\0\u42d7\0\u431e\0\u4365\0\u43ac\0\u43f3\0\u443a\0\u124e"+
+ "\0\u4481\0\u44c8\0\u450f\0\u124e\0\u4556\0\u459d\0\u45e4\0\u462b"+
+ "\0\u4672\0\u46b9\0\u4700\0\u4747\0\u124e\0\u478e\0\u47d5\0\u481c"+
+ "\0\u4863\0\u48aa\0\u48f1\0\u124e\0\u4938\0\u0470\0\u0470\0\u497f"+
+ "\0\u49c6\0\u4a0d\0\u4a54\0\u2afd\0\u4a9b\0\u4ae2\0\u4b29\0\u4b70"+
+ "\0\u4bb7\0\u4bfe\0\u4c45\0\u4c8c\0\u4cd3\0\u4d1a\0\u4d61\0\u2edf"+
+ "\0\u4da8\0\u4def\0\u4e36\0\u4e7d\0\u4ec4\0\u4f0b\0\u4f52\0\u4f99"+
+ "\0\u4fe0\0\u5027\0\u506e\0\u50b5\0\u50fc\0\u5143\0\u518a\0\u51d1"+
+ "\0\u124e\0\u5218\0\u525f\0\u52a6\0\u52ed\0\u5334\0\u124e\0\u124e"+
+ "\0\u537b\0\u53c2\0\u5409\0\u5450\0\u5497\0\u54de\0\u5525\0\u556c"+
+ "\0\u55b3\0\u55fa\0\u5641\0\u5688\0\u56cf\0\u5716\0\u575d\0\u124e"+
+ "\0\u0470\0\u57a4\0\u57eb\0\u5832\0\u5879\0\u58c0\0\u5907\0\u594e"+
+ "\0\u5995\0\u59dc\0\u5a23\0\u5a6a\0\u5ab1\0\u5af8\0\u5b3f\0\u5b86"+
+ "\0\u5bcd\0\u5c14\0\u5c5b\0\u5ca2\0\u4def\0\u0470\0\u5ce9\0\u5d30"+
+ "\0\u5d77\0\u5dbe\0\u5e05\0\u5e4c\0\u5e93\0\u5eda\0\u5f21\0\u5f68"+
+ "\0\u5faf\0\u5ff6\0\u603d\0\u6084\0\u60cb\0\u6112\0\u6159\0\u61a0"+
+ "\0\u61e7\0\u622e\0\u6275\0\u62bc\0\u6303\0\u124e\0\u634a\0\u6391"+
+ "\0\u63d8\0\u641f\0\u124e\0\u6466\0\u64ad\0\u64f4\0\u653b\0\u124e"+
+ "\0\u124e\0\u6582\0\u2a28\0\u65c9\0\u6610\0\u6657\0\u669e\0\u66e5"+
+ "\0\u672c\0\u6773\0\u67ba\0\u6801\0\u6848\0\u688f\0\u68d6\0\u691d"+
+ "\0\u6964\0\u69ab\0\u69f2\0\u6a39\0\u6a80\0\u5c5b\0\u0470\0\u6ac7"+
+ "\0\u6b0e\0\u6b55\0\u6b9c\0\u124e\0\u6be3\0\u124e\0\u124e\0\u6c2a"+
+ "\0\u6c71\0\u6cb8\0\u124e\0\u6cff\0\u6d46\0\u6d8d\0\u6dd4\0\u6e1b"+
+ "\0\u6e62\0\u6ea9\0\u6ef0\0\u6f37\0\u6f7e\0\u6fc5\0\u700c\0\u7053"+
+ "\0\u709a\0\u70e1\0\u7128\0\u716f\0\u71b6\0\u71fd\0\u7244\0\u728b"+
+ "\0\u72d2\0\u7319\0\u7360\0\u2953\0\u0470\0\u73a7\0\u73ee\0\u7435"+
+ "\0\u747c\0\u74c3\0\u750a\0\u7551\0\u7598\0\u75df\0\u7626\0\u766d"+
+ "\0\u76b4\0\u76fb\0\u7742\0\u7789\0\u77d0\0\u7817\0\u785e\0\u78a5"+
+ "\0\u78ec\0\u7933\0\u797a\0\u79c1\0\u7a08\0\u7a4f\0\u7a96\0\u7add"+
+ "\0\u7b24\0\u7b6b\0\u7bb2\0\u7bf9\0\u7c40\0\u7c87\0\u7cce\0\u7d15"+
+ "\0\u7d5c\0\u7da3\0\u7dea\0\u7e31\0\u7e78\0\u7ebf\0\u124e\0\u7f06"+
+ "\0\u7f4d\0\u7f94\0\u7fdb\0\u8022\0\u8069\0\u124e\0\u80b0\0\u80f7"+
+ "\0\u813e\0\u8185\0\u124e\0\u81cc\0\u8213\0\u825a\0\u82a1\0\u82e8"+
+ "\0\u832f\0\u8376\0\u83bd\0\u0470\0\u0470\0\u8404\0\u844b\0\u8492"+
+ "\0\u84d9\0\u8520\0\u8567\0\u85ae\0\u85f5\0\u863c\0\u8683\0\u86ca"+
+ "\0\u8711\0\u8758\0\u879f\0\u87e6\0\u7a08\0\u0470\0\u882d\0\u8874"+
+ "\0\u88bb\0\u8902\0\u8949\0\u8990\0\u89d7\0\u8a1e\0\u8a65\0\u8aac"+
+ "\0\u8af3\0\u8b3a\0\u8b81\0\u8bc8\0\u8c0f\0\u8c56\0\u8c9d\0\u8ce4"+
+ "\0\u8d2b\0\u8d72\0\u8db9\0\u8e00\0\u8e47\0\u8e8e\0\u8ed5\0\u8f1c"+
+ "\0\u8f63\0\u8faa\0\u8ff1\0\u0470\0\u9038\0\u907f\0\u90c6\0\u910d"+
+ "\0\u9154\0\u919b\0\u91e2\0\u9229\0\u9270\0\u92b7\0\u92fe\0\u9345"+
+ "\0\u938c\0\u93d3\0\u941a\0\u9461\0\u94a8\0\u94ef\0\u9536\0\u957d"+
+ "\0\u95c4\0\u960b\0\u9652\0\u9699\0\u96e0\0\u9727\0\u976e\0\u97b5"+
+ "\0\u97fc\0\u9843\0\u988a\0\u98d1\0\u9918\0\u995f\0\u99a6\0\u99ed"+
+ "\0\u9a34\0\u9a7b\0\u9ac2\0\u9b09\0\u9b50\0\u124e\0\u124e\0\u9b97"+
+ "\0\u9bde\0\u9c25\0\u9c6c\0\u9cb3\0\u9cfa\0\u9d41\0\u9d88\0\u8e00"+
+ "\0\u9dcf\0\u8e8e\0\u9e16\0\u9e5d\0\u9ea4\0\u9eeb\0\u0470\0\u9f32"+
+ "\0\u9f79\0\u9fc0\0\ua007\0\ua04e\0\ua095\0\ua0dc\0\ua123\0\ua16a"+
+ "\0\ua1b1\0\ua1f8\0\ua23f\0\ua286\0\ua2cd\0\ua314\0\u960b\0\u0470"+
+ "\0\ua35b\0\ua3a2\0\ua3e9\0\ua430\0\ua477\0\ua4be\0\ua505\0\ua54c"+
+ "\0\ua593\0\ua5da\0\ua621\0\ua668\0\ua6af\0\ua6f6\0\ua73d\0\ua784"+
+ "\0\ua7cb\0\ua812\0\ua859\0\ua8a0\0\ua8e7\0\ua92e\0\ua975\0\ua9bc"+
+ "\0\uaa03\0\uaa4a\0\uaa91\0\uaad8\0\uab1f\0\uab66\0\uabad\0\uabf4"+
+ "\0\uac3b\0\uac82\0\uacc9\0\uad10\0\uad57\0\uad9e\0\uade5\0\uae2c"+
+ "\0\uae73\0\uaeba\0\ua314\0\u0470\0\uaf01\0\uaf48\0\uaf8f\0\uafd6"+
+ "\0\ub01d\0\ub064\0\ub0ab\0\ub0f2\0\ub139\0\ub180\0\ub1c7\0\ub20e"+
+ "\0\ub255\0\ub29c\0\ub2e3\0\ub32a\0\ub371\0\ua8e7\0\ub3b8\0\ub3ff"+
+ "\0\u0470\0\u0470\0\ub446\0\ub48d\0\ub4d4\0\ub51b\0\ub562\0\ub5a9"+
+ "\0\ub5f0\0\ub637\0\ub67e\0\uaf01\0\u0470\0\ub6c5\0\ub70c\0\ub753"+
+ "\0\u0470\0\ub79a\0\u124e\0\ub7e1\0\ub828\0\ub86f\0\ub8b6\0\ub8fd"+
+ "\0\ub3b8\0\ub944\0\ub98b\0\ub3ff\0\ub9d2\0\uba19\0\uba60\0\ubaa7"+
+ "\0\ubaee\0\ubb35\0\ubb7c\0\u0470\0\u124e\0\ubbc3\0\ubc0a\0\ubc51"+
+ "\0\ubc98\0\ubcdf\0\ubd26\0\ubd6d\0\ubdb4\0\ubdfb\0\u0470\0\ubdb4"+
+ "\0\ube42\0\ubdfb";
+
+ private static int [] zzUnpackRowMap() {
+ int [] result = new int[826];
+ int offset = 0;
+ offset = zzUnpackRowMap(ZZ_ROWMAP_PACKED_0, offset, result);
+ return result;
+ }
+
+ private static int zzUnpackRowMap(String packed, int offset, int [] result) {
+ int i = 0; /* index in packed string */
+ int j = offset; /* index in unpacked array */
+ int l = packed.length();
+ while (i < l) {
+ int high = packed.charAt(i++) << 16;
+ result[j++] = high | packed.charAt(i++);
+ }
+ return j;
+ }
+
+ /**
+ * The transition table of the DFA
+ */
+ private static final int [] ZZ_TRANS = zzUnpackTrans();
+
+ private static final String ZZ_TRANS_PACKED_0 =
+ "\11\20\2\21\1\22\13\20\1\21\5\20\1\23\51\20"+
+ "\30\24\1\25\1\26\55\24\2\27\1\30\2\27\2\30"+
+ "\1\27\1\31\1\32\1\33\1\32\1\27\1\34\6\27"+
+ "\1\30\2\27\1\32\7\27\25\30\4\27\1\30\1\27"+
+ "\3\30\6\27\1\30\5\27\1\35\2\27\2\35\1\27"+
+ "\1\36\3\37\10\27\1\35\1\27\1\36\1\37\1\27"+
+ "\1\40\3\27\1\41\1\27\25\35\4\27\1\35\1\42"+
+ "\3\35\6\27\1\35\5\27\1\35\2\27\2\35\1\27"+
+ "\1\43\3\37\10\27\1\35\1\27\1\43\1\37\1\27"+
+ "\1\40\3\27\1\44\1\27\25\35\4\27\1\35\1\42"+
+ "\3\35\6\27\1\35\13\27\4\45\4\27\1\46\5\27"+
+ "\2\45\1\27\1\47\2\27\1\50\52\27\4\51\1\52"+
+ "\3\51\1\53\1\54\1\55\1\54\1\56\1\51\1\57"+
+ "\1\51\1\60\2\51\1\61\2\51\1\53\1\54\1\62"+
+ "\1\63\1\64\3\51\1\65\36\51\1\66\1\67\1\70"+
+ "\1\71\1\72\1\73\1\74\1\75\2\51\31\76\1\77"+
+ "\1\100\1\101\1\102\1\76\1\103\50\76\2\27\1\35"+
+ "\2\27\2\35\1\27\4\104\1\27\1\105\3\27\1\106"+
+ "\2\27\1\35\1\27\2\104\7\27\25\35\4\27\1\35"+
+ "\1\27\3\35\6\27\1\35\3\27\4\107\1\110\4\107"+
+ "\1\111\1\112\1\111\13\107\1\111\2\107\1\113\54\107"+
+ "\4\51\1\52\3\51\3\114\1\115\2\51\1\116\1\117"+
+ "\6\51\2\114\2\51\1\120\3\51\1\121\45\51\1\122"+
+ "\1\51\1\123\11\124\2\125\1\126\13\124\1\125\5\124"+
+ "\1\127\51\124\10\27\1\36\2\27\1\130\1\27\1\131"+
+ "\10\27\1\36\5\27\1\132\62\27\4\133\12\27\2\133"+
+ "\57\27\2\134\1\135\2\134\2\135\15\134\1\135\12\134"+
+ "\25\135\4\134\1\135\1\134\3\135\6\134\1\135\3\134"+
+ "\11\20\2\21\1\22\13\20\1\21\57\20\107\0\11\20"+
+ "\2\21\1\22\13\20\1\21\5\20\1\136\51\20\30\24"+
+ "\1\137\1\140\105\24\1\141\1\142\105\24\1\143\1\144"+
+ "\55\24\1\0\3\30\1\0\3\30\14\0\4\30\7\0"+
+ "\32\30\1\0\3\30\6\0\1\30\13\0\1\31\4\0"+
+ "\1\34\104\0\1\32\103\0\1\34\77\0\3\35\1\0"+
+ "\3\35\14\0\4\35\7\0\32\35\1\0\3\35\6\0"+
+ "\1\35\13\0\1\36\15\0\1\36\71\0\3\37\13\0"+
+ "\1\37\107\0\1\145\1\146\57\0\1\147\2\0\1\147"+
+ "\1\150\15\0\1\147\11\0\1\151\1\152\1\153\1\154"+
+ "\4\147\1\155\1\156\1\157\1\160\1\147\1\161\1\162"+
+ "\1\163\1\147\1\164\1\147\1\165\1\166\1\147\1\167"+
+ "\1\170\1\171\1\0\1\147\1\0\3\147\6\0\1\147"+
+ "\13\0\1\42\15\0\1\42\70\0\1\43\15\0\1\43"+
+ "\6\0\1\172\53\0\1\147\2\0\1\173\1\150\15\0"+
+ "\1\147\10\0\1\174\1\151\1\152\1\153\1\154\4\147"+
+ "\1\155\1\156\1\157\1\160\1\147\1\161\1\175\1\163"+
+ "\1\147\1\164\1\147\1\165\1\166\1\147\1\167\1\170"+
+ "\1\171\1\0\1\147\1\0\3\147\6\0\1\147\13\0"+
+ "\4\45\4\0\1\46\5\0\2\45\1\0\1\176\2\0"+
+ "\1\50\72\0\1\177\116\0\1\200\1\201\55\0\3\202"+
+ "\1\203\1\202\1\204\1\205\1\206\3\202\1\0\24\202"+
+ "\1\207\1\210\1\202\1\211\3\202\1\212\7\202\1\213"+
+ "\4\202\1\203\1\202\1\206\1\203\17\202\10\0\1\53"+
+ "\3\214\1\56\1\0\1\57\4\0\1\61\2\0\1\53"+
+ "\1\214\1\62\1\63\1\64\3\0\1\215\36\0\1\66"+
+ "\1\67\1\70\1\71\1\72\1\73\1\74\1\75\12\0"+
+ "\4\214\1\56\1\0\1\57\4\0\1\61\2\0\2\214"+
+ "\1\62\1\63\1\64\3\0\1\215\36\0\1\66\1\67"+
+ "\1\70\1\71\1\72\1\73\1\74\1\75\12\0\3\214"+
+ "\1\54\1\56\1\0\1\57\4\0\1\61\2\0\2\214"+
+ "\1\62\1\63\1\64\3\0\1\215\36\0\1\66\1\67"+
+ "\1\70\1\71\1\72\1\73\1\74\1\75\107\0\1\216"+
+ "\21\0\1\217\116\0\1\220\1\201\56\0\1\221\1\222"+
+ "\1\221\1\0\2\222\1\221\1\223\13\0\1\222\1\0"+
+ "\1\223\10\0\25\222\4\221\1\222\1\0\3\222\6\0"+
+ "\1\222\13\0\1\224\1\225\1\226\1\225\12\0\1\224"+
+ "\1\225\57\0\31\76\1\227\1\230\1\231\1\0\1\76"+
+ "\1\0\100\76\1\232\1\233\55\76\4\230\1\234\4\230"+
+ "\3\0\13\230\1\0\2\230\1\76\54\230\4\235\1\236"+
+ "\4\235\3\0\13\235\1\0\3\235\1\0\53\235\10\0"+
+ "\4\104\12\0\2\104\67\0\4\106\12\0\2\106\57\0"+
+ "\4\107\1\0\4\107\3\0\13\107\1\0\2\107\1\0"+
+ "\54\107\3\237\1\240\1\237\1\241\1\242\1\243\3\237"+
+ "\1\0\16\237\1\244\5\237\1\245\1\246\1\237\1\247"+
+ "\3\237\1\250\7\237\1\251\4\237\1\240\1\237\1\243"+
+ "\1\240\17\237\13\0\1\111\103\0\4\252\2\0\1\253"+
+ "\7\0\2\252\61\0\1\254\2\0\2\254\15\0\1\254"+
+ "\12\0\25\254\4\0\1\254\1\0\3\254\6\0\1\254"+
+ "\22\0\1\255\67\0\11\256\2\125\1\126\13\256\1\125"+
+ "\70\256\2\125\1\126\13\256\1\125\4\256\1\257\2\256"+
+ "\1\260\6\256\1\261\1\256\1\262\36\256\1\0\1\263"+
+ "\1\0\1\263\3\0\1\263\1\264\15\0\1\264\35\0"+
+ "\4\263\27\0\4\133\12\0\2\133\60\0\3\135\1\0"+
+ "\3\135\1\265\13\0\4\135\7\0\32\135\1\0\3\135"+
+ "\6\0\1\135\3\0\13\136\1\266\73\136\30\24\1\137"+
+ "\1\0\105\24\1\0\1\140\55\24\11\146\2\267\1\270"+
+ "\13\146\1\267\57\146\1\0\3\147\1\0\3\147\14\0"+
+ "\4\147\7\0\32\147\1\0\3\147\6\0\1\147\4\0"+
+ "\3\147\1\0\3\147\14\0\4\147\7\0\1\147\1\271"+
+ "\30\147\1\0\3\147\6\0\1\147\3\0\11\151\2\272"+
+ "\1\273\13\151\1\272\57\151\1\0\3\147\1\0\3\147"+
+ "\14\0\4\147\7\0\1\147\1\274\15\147\1\275\4\147"+
+ "\1\276\5\147\1\0\3\147\6\0\1\147\4\0\3\147"+
+ "\1\0\3\147\14\0\4\147\7\0\5\147\1\277\24\147"+
+ "\1\0\3\147\6\0\1\147\4\0\3\147\1\0\3\147"+
+ "\14\0\4\147\7\0\3\147\1\300\5\147\1\301\2\147"+
+ "\1\302\15\147\1\0\3\147\6\0\1\147\4\0\3\147"+
+ "\1\0\1\303\2\147\14\0\4\147\7\0\5\147\1\304"+
+ "\24\147\1\0\3\147\6\0\1\147\4\0\3\147\1\0"+
+ "\1\147\1\305\1\147\14\0\4\147\7\0\1\306\31\147"+
+ "\1\0\3\147\6\0\1\147\4\0\3\147\1\0\3\147"+
+ "\14\0\4\147\7\0\11\147\1\307\20\147\1\0\3\147"+
+ "\6\0\1\147\4\0\3\147\1\0\3\147\14\0\4\147"+
+ "\7\0\1\310\31\147\1\0\3\147\6\0\1\147\4\0"+
+ "\3\147\1\0\3\147\14\0\4\147\7\0\20\147\1\311"+
+ "\1\147\1\312\7\147\1\0\3\147\6\0\1\147\4\0"+
+ "\3\147\1\0\3\147\14\0\4\147\7\0\2\147\1\313"+
+ "\3\147\1\314\7\147\1\315\13\147\1\0\3\147\6\0"+
+ "\1\147\4\0\3\147\1\0\1\147\1\316\1\147\14\0"+
+ "\4\147\7\0\2\147\1\317\1\320\1\147\1\321\4\147"+
+ "\1\322\1\147\1\323\15\147\1\0\3\147\6\0\1\147"+
+ "\4\0\3\147\1\0\1\147\1\324\1\147\14\0\4\147"+
+ "\7\0\11\147\1\325\20\147\1\0\3\147\6\0\1\147"+
+ "\4\0\3\147\1\0\1\147\1\326\1\147\14\0\4\147"+
+ "\7\0\14\147\1\327\15\147\1\0\3\147\6\0\1\147"+
+ "\4\0\3\147\1\0\3\147\14\0\4\147\7\0\7\147"+
+ "\1\330\22\147\1\0\3\147\6\0\1\147\62\0\1\331"+
+ "\106\0\1\332\116\0\1\333\20\0\3\147\1\0\3\147"+
+ "\1\334\13\0\2\147\1\335\1\147\7\0\15\147\1\336"+
+ "\14\147\1\0\3\147\6\0\1\147\3\0\11\174\3\0"+
+ "\13\174\1\0\57\174\1\0\3\147\1\0\3\147\1\337"+
+ "\13\0\2\147\1\340\1\147\7\0\2\147\1\341\3\147"+
+ "\1\314\7\147\1\315\13\147\1\0\3\147\6\0\1\147"+
+ "\75\0\1\342\14\0\11\201\3\0\13\201\1\0\57\201"+
+ "\3\0\1\343\3\0\1\343\54\0\1\343\1\0\2\343"+
+ "\20\0\3\344\3\0\1\344\36\0\2\344\3\0\1\344"+
+ "\1\0\1\344\1\0\1\344\2\0\1\344\1\0\4\344"+
+ "\2\0\1\344\1\0\1\344\13\0\3\345\3\0\1\345"+
+ "\36\0\2\345\3\0\1\345\1\0\1\345\1\0\1\345"+
+ "\2\0\1\345\1\0\4\345\2\0\1\345\1\0\1\345"+
+ "\15\0\1\203\3\0\1\203\54\0\1\203\1\0\2\203"+
+ "\25\0\1\346\42\0\1\347\6\0\1\350\1\0\1\351"+
+ "\116\0\1\352\15\0\1\221\1\0\1\221\3\0\1\221"+
+ "\54\0\4\221\20\0\3\222\1\0\3\222\1\353\13\0"+
+ "\4\222\4\0\1\354\2\0\32\222\1\0\3\222\6\0"+
+ "\1\222\16\0\1\355\73\0\30\232\1\356\56\232\11\233"+
+ "\2\357\1\76\13\233\1\357\57\233\11\230\3\0\13\230"+
+ "\1\0\57\230\33\0\1\76\53\0\3\235\1\360\1\361"+
+ "\1\235\1\362\1\363\1\235\3\0\13\235\1\0\34\235"+
+ "\1\360\1\235\1\363\1\360\17\235\3\0\1\364\3\0"+
+ "\1\364\54\0\1\364\1\0\2\364\20\0\3\365\3\0"+
+ "\1\365\36\0\2\365\3\0\1\365\1\0\1\365\1\0"+
+ "\1\365\2\0\1\365\1\0\4\365\2\0\1\365\1\0"+
+ "\1\365\13\0\3\366\3\0\1\366\36\0\2\366\3\0"+
+ "\1\366\1\0\1\366\1\0\1\366\2\0\1\366\1\0"+
+ "\4\366\2\0\1\366\1\0\1\366\15\0\1\240\3\0"+
+ "\1\240\54\0\1\240\1\0\2\240\20\0\3\254\1\0"+
+ "\3\254\14\0\4\254\4\0\1\367\2\0\32\254\1\0"+
+ "\3\254\6\0\1\254\3\0\11\257\2\370\1\371\13\257"+
+ "\1\370\57\257\11\256\2\125\1\126\13\256\1\125\10\256"+
+ "\1\372\57\256\2\125\1\126\13\256\1\125\14\256\1\373"+
+ "\53\256\2\125\1\126\13\256\1\125\20\256\1\374\36\256"+
+ "\1\0\1\263\1\0\1\263\3\0\1\263\54\0\4\263"+
+ "\27\0\1\265\15\0\1\265\61\0\3\147\1\0\3\147"+
+ "\14\0\4\147\7\0\1\375\31\147\1\0\3\147\6\0"+
+ "\1\147\4\0\3\147\1\0\3\147\14\0\4\147\7\0"+
+ "\1\376\1\147\1\377\13\147\1\u0100\13\147\1\0\3\147"+
+ "\6\0\1\147\4\0\3\147\1\0\3\147\14\0\4\147"+
+ "\7\0\22\147\1\u0101\7\147\1\0\3\147\6\0\1\147"+
+ "\4\0\3\147\1\0\3\147\14\0\4\147\7\0\1\147"+
+ "\1\u0102\30\147\1\0\3\147\6\0\1\147\4\0\3\147"+
+ "\1\0\3\147\14\0\4\147\7\0\2\147\1\u0103\27\147"+
+ "\1\0\3\147\6\0\1\147\4\0\3\147\1\0\3\147"+
+ "\14\0\4\147\7\0\4\147\1\u0104\25\147\1\0\3\147"+
+ "\6\0\1\147\4\0\3\147\1\0\3\147\14\0\4\147"+
+ "\7\0\22\147\1\u0105\7\147\1\0\3\147\6\0\1\147"+
+ "\4\0\3\147\1\0\3\147\14\0\4\147\7\0\20\147"+
+ "\1\u0106\11\147\1\0\3\147\6\0\1\147\4\0\3\147"+
+ "\1\0\3\147\14\0\4\147\7\0\2\147\1\u0107\27\147"+
+ "\1\0\3\147\6\0\1\147\4\0\3\147\1\0\3\147"+
+ "\14\0\4\147\7\0\10\147\1\u0108\21\147\1\0\3\147"+
+ "\6\0\1\147\4\0\3\147\1\0\3\147\14\0\4\147"+
+ "\7\0\1\147\1\u0109\10\147\1\u010a\17\147\1\0\3\147"+
+ "\6\0\1\147\4\0\3\147\1\0\3\147\14\0\4\147"+
+ "\7\0\1\147\1\u010b\30\147\1\0\3\147\6\0\1\147"+
+ "\4\0\3\147\1\0\3\147\14\0\4\147\7\0\7\147"+
+ "\1\u010c\2\147\1\u010d\17\147\1\0\3\147\6\0\1\147"+
+ "\4\0\3\147\1\0\3\147\14\0\4\147\7\0\1\147"+
+ "\1\u010e\30\147\1\0\3\147\6\0\1\147\4\0\3\147"+
+ "\1\0\3\147\14\0\4\147\7\0\15\147\1\u010f\14\147"+
+ "\1\0\3\147\6\0\1\147\4\0\3\147\1\0\3\147"+
+ "\14\0\4\147\7\0\1\u0110\31\147\1\0\3\147\6\0"+
+ "\1\147\4\0\3\147\1\0\3\147\14\0\4\147\7\0"+
+ "\14\147\1\u0111\15\147\1\0\3\147\6\0\1\147\4\0"+
+ "\3\147\1\0\3\147\14\0\4\147\7\0\1\u0112\31\147"+
+ "\1\0\3\147\6\0\1\147\4\0\3\147\1\0\3\147"+
+ "\14\0\4\147\7\0\14\147\1\u0113\15\147\1\0\3\147"+
+ "\6\0\1\147\4\0\3\147\1\0\3\147\14\0\4\147"+
+ "\7\0\22\147\1\u0114\7\147\1\0\3\147\6\0\1\147"+
+ "\4\0\3\147\1\0\3\147\14\0\4\147\7\0\5\147"+
+ "\1\u0115\24\147\1\0\3\147\6\0\1\147\4\0\3\147"+
+ "\1\0\3\147\14\0\4\147\7\0\14\147\1\u0116\15\147"+
+ "\1\0\3\147\6\0\1\147\4\0\3\147\1\0\3\147"+
+ "\14\0\4\147\7\0\12\147\1\u0117\17\147\1\0\3\147"+
+ "\6\0\1\147\4\0\3\147\1\0\3\147\14\0\4\147"+
+ "\7\0\14\147\1\u0118\15\147\1\0\3\147\6\0\1\147"+
+ "\4\0\3\147\1\0\3\147\14\0\4\147\7\0\15\147"+
+ "\1\u0119\14\147\1\0\3\147\6\0\1\147\4\0\3\147"+
+ "\1\0\3\147\14\0\4\147\7\0\10\147\1\u011a\21\147"+
+ "\1\0\3\147\6\0\1\147\4\0\3\147\1\0\3\147"+
+ "\14\0\4\147\7\0\14\147\1\u011b\15\147\1\0\3\147"+
+ "\6\0\1\147\4\0\3\147\1\0\3\147\14\0\4\147"+
+ "\7\0\20\147\1\u011c\11\147\1\0\3\147\6\0\1\147"+
+ "\4\0\3\147\1\0\3\147\14\0\4\147\7\0\16\147"+
+ "\1\u011d\13\147\1\0\3\147\6\0\1\147\4\0\3\147"+
+ "\1\0\3\147\14\0\4\147\7\0\20\147\1\u011e\11\147"+
+ "\1\0\3\147\6\0\1\147\42\0\1\u011f\106\0\1\u0120"+
+ "\126\0\1\u0121\37\0\1\334\15\0\1\334\61\0\3\147"+
+ "\1\0\3\147\1\334\13\0\2\147\1\335\1\147\7\0"+
+ "\32\147\1\0\3\147\6\0\1\147\4\0\3\147\1\0"+
+ "\3\147\14\0\4\147\7\0\2\147\1\u0122\27\147\1\0"+
+ "\3\147\6\0\1\147\13\0\1\337\15\0\1\337\61\0"+
+ "\3\147\1\0\3\147\1\337\13\0\2\147\1\340\1\147"+
+ "\7\0\32\147\1\0\3\147\6\0\1\147\4\0\3\147"+
+ "\1\0\3\147\14\0\4\147\7\0\14\147\1\u0123\15\147"+
+ "\1\0\3\147\6\0\1\147\76\0\1\u0124\14\0\3\u0125"+
+ "\3\0\1\u0125\36\0\2\u0125\3\0\1\u0125\1\0\1\u0125"+
+ "\1\0\1\u0125\2\0\1\u0125\1\0\4\u0125\2\0\1\u0125"+
+ "\1\0\1\u0125\13\0\3\u0126\3\0\1\u0126\36\0\2\u0126"+
+ "\3\0\1\u0126\1\0\1\u0126\1\0\1\u0126\2\0\1\u0126"+
+ "\1\0\4\u0126\2\0\1\u0126\1\0\1\u0126\73\0\1\u0127"+
+ "\71\0\1\u0128\1\0\1\u0129\111\0\1\u012a\74\0\1\u012b"+
+ "\142\0\1\u012c\23\0\1\353\15\0\1\353\5\0\1\354"+
+ "\52\0\30\232\1\356\1\76\55\232\13\357\1\76\15\357"+
+ "\1\u012d\1\u012e\1\u012f\1\233\1\357\1\233\50\357\3\0"+
+ "\1\235\3\0\1\235\23\0\1\76\30\0\1\235\1\0"+
+ "\2\235\23\0\1\u0130\1\0\1\u0131\24\0\1\76\54\0"+
+ "\3\u0132\3\0\1\u0132\23\0\1\76\12\0\2\u0132\3\0"+
+ "\1\u0132\1\0\1\u0132\1\0\1\u0132\2\0\1\u0132\1\0"+
+ "\4\u0132\2\0\1\u0132\1\0\1\u0132\15\0\1\360\3\0"+
+ "\1\360\23\0\1\76\30\0\1\360\1\0\2\360\20\0"+
+ "\3\u0133\3\0\1\u0133\36\0\2\u0133\3\0\1\u0133\1\0"+
+ "\1\u0133\1\0\1\u0133\2\0\1\u0133\1\0\4\u0133\2\0"+
+ "\1\u0133\1\0\1\u0133\13\0\3\u0134\3\0\1\u0134\36\0"+
+ "\2\u0134\3\0\1\u0134\1\0\1\u0134\1\0\1\u0134\2\0"+
+ "\1\u0134\1\0\4\u0134\2\0\1\u0134\1\0\1\u0134\12\0"+
+ "\11\256\2\125\1\126\13\256\1\125\7\256\1\u0135\60\256"+
+ "\2\125\1\126\13\256\1\125\17\256\1\u0136\50\256\2\125"+
+ "\1\126\13\256\1\125\21\256\1\u0137\35\256\1\0\3\147"+
+ "\1\0\3\147\14\0\4\147\7\0\16\147\1\u0138\13\147"+
+ "\1\0\3\147\6\0\1\147\4\0\3\147\1\0\3\147"+
+ "\14\0\4\147\7\0\2\147\1\u0139\27\147\1\0\3\147"+
+ "\6\0\1\147\4\0\3\147\1\0\3\147\14\0\4\147"+
+ "\7\0\6\147\1\u013a\1\u013b\22\147\1\0\3\147\6\0"+
+ "\1\147\4\0\3\147\1\0\3\147\14\0\4\147\7\0"+
+ "\12\147\1\u013c\17\147\1\0\3\147\6\0\1\147\4\0"+
+ "\3\147\1\0\3\147\14\0\4\147\7\0\12\147\1\u013d"+
+ "\17\147\1\0\3\147\6\0\1\147\4\0\3\147\1\0"+
+ "\3\147\14\0\4\147\7\0\5\147\1\u013e\24\147\1\0"+
+ "\3\147\6\0\1\147\4\0\3\147\1\0\1\147\1\u013f"+
+ "\1\147\14\0\4\147\7\0\32\147\1\0\3\147\6\0"+
+ "\1\147\4\0\3\147\1\0\3\147\14\0\4\147\7\0"+
+ "\5\147\1\u0140\24\147\1\0\3\147\6\0\1\147\4\0"+
+ "\3\147\1\0\3\147\14\0\4\147\7\0\7\147\1\u0141"+
+ "\22\147\1\0\3\147\6\0\1\147\4\0\3\147\1\0"+
+ "\3\147\14\0\4\147\7\0\12\147\1\u0142\17\147\1\0"+
+ "\3\147\6\0\1\147\4\0\3\147\1\0\3\147\14\0"+
+ "\4\147\7\0\7\147\1\u0143\22\147\1\0\3\147\6\0"+
+ "\1\147\4\0\3\147\1\0\3\147\14\0\4\147\6\0"+
+ "\1\151\2\147\1\u0144\10\147\1\u0145\2\147\1\u0146\13\147"+
+ "\1\0\3\147\6\0\1\147\4\0\3\147\1\0\3\147"+
+ "\14\0\4\147\7\0\16\147\1\u0147\13\147\1\0\3\147"+
+ "\6\0\1\147\4\0\3\147\1\0\3\147\14\0\4\147"+
+ "\7\0\12\147\1\u0148\17\147\1\0\3\147\6\0\1\147"+
+ "\4\0\3\147\1\0\3\147\14\0\4\147\7\0\14\147"+
+ "\1\u0149\15\147\1\0\3\147\6\0\1\147\4\0\3\147"+
+ "\1\0\3\147\14\0\4\147\7\0\5\147\1\u014a\24\147"+
+ "\1\0\3\147\6\0\1\147\4\0\3\147\1\0\3\147"+
+ "\14\0\4\147\7\0\7\147\1\u014b\22\147\1\0\3\147"+
+ "\6\0\1\147\4\0\3\147\1\0\3\147\14\0\4\147"+
+ "\7\0\7\147\1\u014c\22\147\1\0\3\147\6\0\1\147"+
+ "\4\0\3\147\1\0\3\147\14\0\4\147\7\0\2\147"+
+ "\1\u014d\27\147\1\0\3\147\6\0\1\147\4\0\3\147"+
+ "\1\0\3\147\14\0\4\147\7\0\22\147\1\u014e\7\147"+
+ "\1\0\3\147\6\0\1\147\4\0\3\147\1\0\3\147"+
+ "\14\0\4\147\7\0\1\147\1\u014f\30\147\1\0\3\147"+
+ "\6\0\1\147\4\0\3\147\1\0\3\147\14\0\4\147"+
+ "\7\0\2\147\1\u0150\27\147\1\0\3\147\6\0\1\147"+
+ "\4\0\3\147\1\0\3\147\14\0\4\147\7\0\1\147"+
+ "\1\u0151\30\147\1\0\3\147\6\0\1\147\4\0\3\147"+
+ "\1\0\3\147\14\0\4\147\7\0\15\147\1\u0152\5\147"+
+ "\1\u0153\6\147\1\0\3\147\6\0\1\147\4\0\3\147"+
+ "\1\0\3\147\14\0\4\147\7\0\4\147\1\u0154\25\147"+
+ "\1\0\3\147\6\0\1\147\4\0\3\147\1\0\3\147"+
+ "\14\0\4\147\7\0\4\147\1\u0155\25\147\1\0\3\147"+
+ "\6\0\1\147\4\0\3\147\1\0\1\147\1\u0156\1\147"+
+ "\14\0\4\147\7\0\32\147\1\0\3\147\6\0\1\147"+
+ "\4\0\3\147\1\0\3\147\14\0\4\147\7\0\15\147"+
+ "\1\u0157\14\147\1\0\3\147\6\0\1\147\4\0\3\147"+
+ "\1\0\3\147\14\0\4\147\7\0\7\147\1\u0158\22\147"+
+ "\1\0\3\147\6\0\1\147\4\0\3\147\1\0\3\147"+
+ "\14\0\4\147\7\0\10\147\1\u0159\21\147\1\0\3\147"+
+ "\6\0\1\147\4\0\3\147\1\0\3\147\14\0\4\147"+
+ "\7\0\16\147\1\u015a\13\147\1\0\3\147\6\0\1\147"+
+ "\4\0\3\147\1\0\3\147\14\0\4\147\7\0\12\147"+
+ "\1\u015b\17\147\1\0\3\147\6\0\1\147\4\0\3\147"+
+ "\1\0\3\147\14\0\4\147\7\0\31\147\1\u015c\1\0"+
+ "\3\147\6\0\1\147\4\0\3\147\1\0\1\147\1\u015d"+
+ "\1\147\14\0\4\147\7\0\32\147\1\0\3\147\6\0"+
+ "\1\147\44\0\1\u015e\106\0\1\u015f\104\0\1\u0160\50\0"+
+ "\3\147\1\0\3\147\14\0\4\147\7\0\14\147\1\u0161"+
+ "\15\147\1\0\3\147\6\0\1\147\4\0\3\147\1\0"+
+ "\3\147\14\0\4\147\7\0\1\147\1\u014f\1\u0162\27\147"+
+ "\1\0\3\147\6\0\1\147\77\0\1\u0163\13\0\3\u0164"+
+ "\3\0\1\u0164\36\0\2\u0164\3\0\1\u0164\1\0\1\u0164"+
+ "\1\0\1\u0164\2\0\1\u0164\1\0\4\u0164\2\0\1\u0164"+
+ "\1\0\1\u0164\73\0\1\u0165\72\0\1\u0166\102\0\1\u0167"+
+ "\113\0\1\u0168\123\0\1\u0169\117\0\1\u016a\12\0\13\357"+
+ "\1\76\14\357\1\u016b\1\233\55\357\4\u012e\1\u016c\4\u012e"+
+ "\2\357\1\76\13\u012e\1\357\2\u012e\1\357\54\u012e\4\u016d"+
+ "\1\u016e\4\u016d\2\357\1\76\13\u016d\1\357\3\u016d\1\233"+
+ "\53\u016d\4\0\1\u0130\1\0\1\u0131\101\0\3\u0132\3\0"+
+ "\1\u0132\36\0\2\u0132\3\0\1\u0132\1\0\1\u0132\1\0"+
+ "\1\u0132\2\0\1\u0132\1\0\4\u0132\2\0\1\u0132\1\0"+
+ "\1\u0132\13\0\3\u016f\3\0\1\u016f\36\0\2\u016f\3\0"+
+ "\1\u016f\1\0\1\u016f\1\0\1\u016f\2\0\1\u016f\1\0"+
+ "\4\u016f\2\0\1\u016f\1\0\1\u016f\13\0\3\u0170\3\0"+
+ "\1\u0170\36\0\2\u0170\3\0\1\u0170\1\0\1\u0170\1\0"+
+ "\1\u0170\2\0\1\u0170\1\0\4\u0170\2\0\1\u0170\1\0"+
+ "\1\u0170\12\0\11\256\2\125\1\126\13\256\1\125\11\256"+
+ "\1\u0171\56\256\2\125\1\126\13\256\1\125\4\256\1\u0172"+
+ "\4\256\1\u0173\10\256\1\u0174\45\256\2\125\1\126\13\256"+
+ "\1\125\16\256\1\u0175\40\256\1\0\3\147\1\0\3\147"+
+ "\14\0\4\147\7\0\5\147\1\u0176\24\147\1\0\3\147"+
+ "\6\0\1\147\4\0\3\147\1\0\3\147\14\0\4\147"+
+ "\6\0\1\151\2\147\1\u0177\27\147\1\0\3\147\6\0"+
+ "\1\147\4\0\3\147\1\0\3\147\14\0\4\147\7\0"+
+ "\4\147\1\u0178\25\147\1\0\3\147\6\0\1\147\4\0"+
+ "\3\147\1\0\3\147\14\0\4\147\7\0\24\147\1\u0179"+
+ "\5\147\1\0\3\147\6\0\1\147\4\0\3\147\1\0"+
+ "\1\147\1\u017a\1\147\14\0\4\147\7\0\32\147\1\0"+
+ "\3\147\6\0\1\147\4\0\3\147\1\0\3\147\14\0"+
+ "\4\147\7\0\7\147\1\u017b\22\147\1\0\3\147\6\0"+
+ "\1\147\4\0\3\147\1\0\3\147\14\0\4\147\7\0"+
+ "\4\147\1\u017c\25\147\1\0\3\147\6\0\1\147\4\0"+
+ "\3\147\1\0\3\147\14\0\4\147\7\0\1\147\1\u017d"+
+ "\30\147\1\0\3\147\6\0\1\147\4\0\3\147\1\0"+
+ "\3\147\14\0\4\147\7\0\6\147\1\u017e\23\147\1\0"+
+ "\3\147\6\0\1\147\4\0\3\147\1\0\3\147\1\u017f"+
+ "\13\0\2\147\1\u0180\1\147\7\0\32\147\1\0\3\147"+
+ "\6\0\1\147\4\0\3\147\1\0\3\147\14\0\4\147"+
+ "\7\0\7\147\1\u0181\22\147\1\0\3\147\6\0\1\147"+
+ "\4\0\3\147\1\0\3\147\14\0\4\147\7\0\1\147"+
+ "\1\u0182\30\147\1\0\3\147\6\0\1\147\4\0\3\147"+
+ "\1\0\3\147\14\0\4\147\7\0\3\147\1\u0183\26\147"+
+ "\1\0\3\147\6\0\1\147\4\0\3\147\1\0\3\147"+
+ "\14\0\4\147\7\0\14\147\1\u0184\15\147\1\0\3\147"+
+ "\6\0\1\147\4\0\3\147\1\0\3\147\14\0\4\147"+
+ "\7\0\12\147\1\u0185\17\147\1\0\3\147\6\0\1\147"+
+ "\4\0\3\147\1\0\3\147\14\0\4\147\7\0\2\147"+
+ "\1\u0186\27\147\1\0\3\147\6\0\1\147\4\0\3\147"+
+ "\1\0\3\147\14\0\4\147\7\0\12\147\1\u0187\17\147"+
+ "\1\0\3\147\6\0\1\147\4\0\3\147\1\0\3\147"+
+ "\14\0\4\147\7\0\10\147\1\u0188\21\147\1\0\3\147"+
+ "\6\0\1\147\4\0\3\147\1\0\1\u0189\2\147\14\0"+
+ "\4\147\7\0\32\147\1\0\3\147\6\0\1\147\4\0"+
+ "\3\147\1\0\3\147\14\0\4\147\7\0\4\147\1\u018a"+
+ "\25\147\1\0\3\147\6\0\1\147\4\0\3\147\1\0"+
+ "\3\147\14\0\4\147\7\0\4\147\1\u018b\25\147\1\0"+
+ "\3\147\6\0\1\147\4\0\3\147\1\0\3\147\14\0"+
+ "\4\147\7\0\23\147\1\u018c\6\147\1\0\3\147\6\0"+
+ "\1\147\4\0\3\147\1\0\3\147\14\0\4\147\7\0"+
+ "\16\147\1\u018d\13\147\1\0\3\147\6\0\1\147\4\0"+
+ "\3\147\1\0\3\147\14\0\4\147\7\0\7\147\1\u018e"+
+ "\22\147\1\0\3\147\6\0\1\147\4\0\3\147\1\0"+
+ "\3\147\14\0\4\147\7\0\11\147\1\u018f\20\147\1\0"+
+ "\3\147\6\0\1\147\4\0\3\147\1\0\3\147\14\0"+
+ "\4\147\7\0\7\147\1\u0190\22\147\1\0\3\147\6\0"+
+ "\1\147\4\0\3\147\1\0\3\147\14\0\4\147\7\0"+
+ "\14\147\1\u0191\15\147\1\0\3\147\6\0\1\147\4\0"+
+ "\3\147\1\0\3\147\14\0\4\147\7\0\17\147\1\u0192"+
+ "\12\147\1\0\3\147\6\0\1\147\4\0\3\147\1\0"+
+ "\3\147\14\0\4\147\7\0\15\147\1\u0193\14\147\1\0"+
+ "\3\147\6\0\1\147\4\0\3\147\1\0\3\147\14\0"+
+ "\4\147\7\0\12\147\1\u0194\17\147\1\0\3\147\6\0"+
+ "\1\147\4\0\3\147\1\0\3\147\14\0\4\147\7\0"+
+ "\7\147\1\u0195\22\147\1\0\3\147\6\0\1\147\4\0"+
+ "\3\147\1\0\3\147\14\0\4\147\7\0\16\147\1\u0196"+
+ "\13\147\1\0\3\147\6\0\1\147\4\0\3\147\1\0"+
+ "\3\147\14\0\4\147\7\0\1\u0197\31\147\1\0\3\147"+
+ "\6\0\1\147\4\0\3\147\1\0\3\147\14\0\4\147"+
+ "\7\0\24\147\1\u0198\5\147\1\0\3\147\6\0\1\147"+
+ "\44\0\1\u0199\46\0\3\147\1\0\3\147\14\0\4\147"+
+ "\7\0\2\147\1\u019a\27\147\1\0\3\147\6\0\1\147"+
+ "\4\0\3\147\1\0\3\147\14\0\4\147\7\0\7\147"+
+ "\1\u019b\22\147\1\0\3\147\6\0\1\147\24\0\1\u019c"+
+ "\133\0\1\u019d\106\0\1\u019e\101\0\1\u019f\106\0\1\u01a0"+
+ "\104\0\1\u01a1\70\0\1\u01a2\65\0\11\u016b\2\u01a3\1\u01a4"+
+ "\13\u016b\1\u01a3\1\u01a5\56\u016b\11\u012e\2\357\1\76\13\u012e"+
+ "\1\357\57\u012e\11\233\2\357\1\76\13\233\1\357\3\233"+
+ "\1\357\53\233\3\u016d\1\u01a6\1\u01a7\1\u016d\1\u01a8\1\u01a9"+
+ "\1\u016d\2\357\1\76\13\u016d\1\357\34\u016d\1\u01a6\1\u016d"+
+ "\1\u01a9\1\u01a6\17\u016d\1\0\3\u01aa\3\0\1\u01aa\36\0"+
+ "\2\u01aa\3\0\1\u01aa\1\0\1\u01aa\1\0\1\u01aa\2\0"+
+ "\1\u01aa\1\0\4\u01aa\2\0\1\u01aa\1\0\1\u01aa\12\0"+
+ "\11\256\2\125\1\126\13\256\1\125\4\256\1\u01ab\4\256"+
+ "\1\u01ac\45\256\11\u0172\2\u01ad\1\u01ae\13\u0172\1\u01ad\57\u0172"+
+ "\11\256\2\125\1\126\13\256\1\125\12\256\1\u01af\55\256"+
+ "\2\125\1\126\13\256\1\125\23\256\1\u01b0\40\256\1\u01b1"+
+ "\3\256\2\125\1\126\13\256\1\125\57\256\1\0\3\147"+
+ "\1\0\3\147\14\0\4\147\7\0\23\147\1\u01b2\6\147"+
+ "\1\0\3\147\6\0\1\147\4\0\3\147\1\0\3\147"+
+ "\14\0\4\147\7\0\3\147\1\u01b3\26\147\1\0\3\147"+
+ "\6\0\1\147\4\0\3\147\1\0\3\147\14\0\4\147"+
+ "\7\0\14\147\1\u01b4\15\147\1\0\3\147\6\0\1\147"+
+ "\4\0\3\147\1\0\3\147\14\0\4\147\7\0\7\147"+
+ "\1\u01b5\22\147\1\0\3\147\6\0\1\147\4\0\3\147"+
+ "\1\0\3\147\14\0\4\147\7\0\23\147\1\u01b6\6\147"+
+ "\1\0\3\147\6\0\1\147\4\0\3\147\1\0\3\147"+
+ "\14\0\4\147\7\0\17\147\1\u01b7\12\147\1\0\3\147"+
+ "\6\0\1\147\4\0\3\147\1\0\3\147\14\0\4\147"+
+ "\7\0\7\147\1\u01b8\22\147\1\0\3\147\6\0\1\147"+
+ "\4\0\3\147\1\0\3\147\14\0\4\147\7\0\1\u01b9"+
+ "\31\147\1\0\3\147\6\0\1\147\4\0\3\147\1\0"+
+ "\3\147\14\0\4\147\7\0\15\147\1\u01ba\14\147\1\0"+
+ "\3\147\6\0\1\147\5\0\1\u01bb\2\0\2\u01bb\1\0"+
+ "\1\u017f\7\0\1\u01bc\3\0\1\u01bb\1\0\1\u017f\10\0"+
+ "\25\u01bb\4\0\1\u01bb\1\0\3\u01bb\6\0\1\u01bb\4\0"+
+ "\1\147\1\u01bb\1\147\1\0\2\u01bb\1\147\1\u017f\7\0"+
+ "\1\u01bc\3\0\1\u01bb\1\147\1\u0180\1\147\7\0\25\u01bb"+
+ "\4\147\1\u01bb\1\0\3\u01bb\6\0\1\u01bb\4\0\3\147"+
+ "\1\0\3\147\14\0\4\147\7\0\23\147\1\u01bd\6\147"+
+ "\1\0\3\147\6\0\1\147\4\0\3\147\1\0\3\147"+
+ "\14\0\4\147\7\0\4\147\1\u01be\25\147\1\0\3\147"+
+ "\6\0\1\147\4\0\3\147\1\0\3\147\14\0\4\147"+
+ "\7\0\12\147\1\u01bf\17\147\1\0\3\147\6\0\1\147"+
+ "\4\0\3\147\1\0\3\147\14\0\4\147\7\0\5\147"+
+ "\1\u01c0\24\147\1\0\3\147\6\0\1\147\4\0\3\147"+
+ "\1\0\3\147\14\0\4\147\7\0\1\u01c1\31\147\1\0"+
+ "\3\147\6\0\1\147\4\0\3\147\1\0\3\147\14\0"+
+ "\4\147\7\0\2\147\1\u01c2\27\147\1\0\3\147\6\0"+
+ "\1\147\4\0\3\147\1\0\3\147\14\0\4\147\7\0"+
+ "\14\147\1\u01c3\15\147\1\0\3\147\6\0\1\147\4\0"+
+ "\3\147\1\0\3\147\14\0\4\147\7\0\1\u01c4\31\147"+
+ "\1\0\3\147\6\0\1\147\4\0\3\147\1\0\3\147"+
+ "\14\0\4\147\7\0\14\147\1\u01c5\15\147\1\0\3\147"+
+ "\6\0\1\147\4\0\3\147\1\0\3\147\14\0\4\147"+
+ "\7\0\3\147\1\u01c6\26\147\1\0\3\147\6\0\1\147"+
+ "\4\0\3\147\1\0\3\147\14\0\4\147\7\0\4\147"+
+ "\1\u01c7\25\147\1\0\3\147\6\0\1\147\4\0\3\147"+
+ "\1\0\3\147\14\0\4\147\7\0\17\147\1\u01c8\12\147"+
+ "\1\0\3\147\6\0\1\147\4\0\3\147\1\0\3\147"+
+ "\14\0\4\147\7\0\20\147\1\u01c9\11\147\1\0\3\147"+
+ "\6\0\1\147\4\0\3\147\1\0\3\147\14\0\4\147"+
+ "\7\0\4\147\1\u01ca\25\147\1\0\3\147\6\0\1\147"+
+ "\4\0\3\147\1\0\3\147\14\0\4\147\7\0\1\147"+
+ "\1\u01cb\30\147\1\0\3\147\6\0\1\147\4\0\3\147"+
+ "\1\0\3\147\1\u01cc\13\0\2\147\1\u01cd\1\147\7\0"+
+ "\32\147\1\0\3\147\6\0\1\147\4\0\3\147\1\0"+
+ "\3\147\14\0\4\147\7\0\7\147\1\u01ce\22\147\1\0"+
+ "\3\147\6\0\1\147\4\0\3\147\1\0\3\147\14\0"+
+ "\4\147\7\0\4\147\1\u01cf\25\147\1\0\3\147\6\0"+
+ "\1\147\4\0\3\147\1\0\3\147\14\0\4\147\7\0"+
+ "\21\147\1\u01d0\10\147\1\0\3\147\6\0\1\147\4\0"+
+ "\3\147\1\0\3\147\14\0\4\147\7\0\16\147\1\u01d1"+
+ "\13\147\1\0\3\147\6\0\1\147\4\0\3\147\1\0"+
+ "\3\147\14\0\4\147\7\0\7\147\1\u01d2\22\147\1\0"+
+ "\3\147\6\0\1\147\4\0\3\147\1\0\3\147\1\337"+
+ "\13\0\2\147\1\340\1\147\7\0\15\147\1\u01d3\14\147"+
+ "\1\0\3\147\6\0\1\147\24\0\1\u01d4\130\0\1\u01d5"+
+ "\106\0\1\u01d6\111\0\1\u01d7\101\0\1\u01d8\106\0\1\u01d9"+
+ "\66\0\1\u01da\65\0\13\u01a3\1\u01a4\14\u01a3\1\u01db\1\u01dc"+
+ "\1\u01dd\1\u01de\1\u016b\1\u01a3\1\u016b\50\u01a3\30\u01a4\1\u01df"+
+ "\1\u01e0\1\u01e1\1\u01e2\1\232\1\u01a4\1\232\50\u01a4\11\u016b"+
+ "\2\u01a3\1\u01a4\13\u016b\1\u01a3\1\u01a5\1\357\55\u016b\3\233"+
+ "\1\u016d\3\233\1\u016d\1\233\2\357\1\76\13\233\1\357"+
+ "\3\233\1\357\30\233\1\u016d\1\233\2\u016d\23\233\1\u01e3"+
+ "\1\233\1\u01e4\2\233\2\357\1\76\13\233\1\357\3\233"+
+ "\1\357\54\233\3\u01e5\3\233\1\u01e5\1\233\2\357\1\76"+
+ "\13\233\1\357\3\233\1\357\12\233\2\u01e5\3\233\1\u01e5"+
+ "\1\233\1\u01e5\1\233\1\u01e5\2\233\1\u01e5\1\233\4\u01e5"+
+ "\2\233\1\u01e5\1\233\1\u01e5\15\233\1\u01a6\3\233\1\u01a6"+
+ "\1\233\2\357\1\76\13\233\1\357\3\233\1\357\30\233"+
+ "\1\u01a6\1\233\2\u01a6\17\233\1\0\3\235\3\0\1\235"+
+ "\36\0\2\235\3\0\1\235\1\0\1\235\1\0\1\235"+
+ "\2\0\1\235\1\0\4\235\2\0\1\235\1\0\1\235"+
+ "\12\0\11\u01ab\2\u01e6\1\u01e7\13\u01ab\1\u01e6\57\u01ab\11\256"+
+ "\2\125\1\126\13\256\1\125\12\256\1\u01e8\55\256\2\125"+
+ "\1\126\13\256\1\125\13\256\1\u01e9\54\256\2\125\1\126"+
+ "\13\256\1\125\21\256\1\u01ea\46\256\2\125\1\126\13\256"+
+ "\1\125\11\256\1\u01eb\45\256\1\0\3\147\1\0\3\147"+
+ "\14\0\4\147\7\0\7\147\1\u01ec\22\147\1\0\3\147"+
+ "\6\0\1\147\4\0\3\147\1\0\3\147\14\0\4\147"+
+ "\7\0\4\147\1\u01ed\25\147\1\0\3\147\6\0\1\147"+
+ "\4\0\3\147\1\0\3\147\14\0\4\147\7\0\22\147"+
+ "\1\u01ee\7\147\1\0\3\147\6\0\1\147\4\0\3\147"+
+ "\1\0\3\147\14\0\4\147\7\0\4\147\1\u01ef\25\147"+
+ "\1\0\3\147\6\0\1\147\4\0\3\147\1\0\3\147"+
+ "\14\0\4\147\7\0\7\147\1\u01f0\22\147\1\0\3\147"+
+ "\6\0\1\147\4\0\3\147\1\0\3\147\14\0\4\147"+
+ "\7\0\7\147\1\u01f1\22\147\1\0\3\147\6\0\1\147"+
+ "\4\0\3\147\1\0\3\147\14\0\4\147\7\0\16\147"+
+ "\1\u01f2\13\147\1\0\3\147\6\0\1\147\4\0\3\147"+
+ "\1\0\1\u01f3\2\147\14\0\4\147\7\0\32\147\1\0"+
+ "\3\147\6\0\1\147\4\0\3\147\1\0\3\147\1\u01f4"+
+ "\13\0\2\147\1\u01f5\1\147\7\0\32\147\1\0\3\147"+
+ "\6\0\1\147\4\0\3\u01bb\1\0\3\u01bb\1\u01f6\3\0"+
+ "\1\u01f7\1\0\1\u01f8\1\0\1\u01f9\3\0\4\u01bb\7\0"+
+ "\32\u01bb\1\0\3\u01bb\6\0\1\u01bb\4\0\3\u01fa\1\0"+
+ "\4\u01fa\3\0\2\u01fa\2\0\10\u01fa\7\0\32\u01fa\1\0"+
+ "\3\u01fa\6\0\1\u01fa\4\0\3\147\1\0\3\147\14\0"+
+ "\4\147\7\0\15\147\1\u01fb\14\147\1\0\3\147\6\0"+
+ "\1\147\4\0\3\147\1\0\3\147\14\0\4\147\7\0"+
+ "\5\147\1\u01fc\24\147\1\0\3\147\6\0\1\147\4\0"+
+ "\3\147\1\0\3\147\14\0\4\147\6\0\1\151\32\147"+
+ "\1\0\3\147\6\0\1\147\4\0\3\147\1\0\3\147"+
+ "\14\0\4\147\7\0\15\147\1\u01fd\14\147\1\0\3\147"+
+ "\6\0\1\147\4\0\3\147\1\0\3\147\14\0\4\147"+
+ "\7\0\5\147\1\u01fe\24\147\1\0\3\147\6\0\1\147"+
+ "\4\0\3\147\1\0\3\147\14\0\4\147\7\0\3\147"+
+ "\1\u01ff\26\147\1\0\3\147\6\0\1\147\4\0\3\147"+
+ "\1\0\3\147\14\0\4\147\7\0\16\147\1\u0200\13\147"+
+ "\1\0\3\147\6\0\1\147\4\0\3\147\1\0\3\147"+
+ "\14\0\4\147\7\0\13\147\1\u0201\16\147\1\0\3\147"+
+ "\6\0\1\147\4\0\3\147\1\0\3\147\14\0\4\147"+
+ "\7\0\12\147\1\u0202\17\147\1\0\3\147\6\0\1\147"+
+ "\4\0\3\147\1\0\3\147\14\0\4\147\7\0\4\147"+
+ "\1\u0203\25\147\1\0\3\147\6\0\1\147\4\0\3\147"+
+ "\1\0\3\147\1\u0204\13\0\2\147\1\u0205\1\147\7\0"+
+ "\32\147\1\0\3\147\6\0\1\147\4\0\3\147\1\0"+
+ "\1\147\1\u0206\1\147\14\0\4\147\7\0\32\147\1\0"+
+ "\3\147\6\0\1\147\4\0\3\147\1\0\3\147\14\0"+
+ "\4\147\7\0\24\147\1\u0207\5\147\1\0\3\147\6\0"+
+ "\1\147\5\0\1\u0208\2\0\2\u0208\1\0\1\u01cc\13\0"+
+ "\1\u0208\1\0\1\u01cc\10\0\25\u0208\4\0\1\u0208\1\0"+
+ "\3\u0208\6\0\1\u0208\4\0\1\147\1\u0208\1\147\1\0"+
+ "\2\u0208\1\147\1\u01cc\13\0\1\u0208\1\147\1\u01cd\1\147"+
+ "\7\0\25\u0208\4\147\1\u0208\1\0\3\u0208\6\0\1\u0208"+
+ "\4\0\3\147\1\0\3\147\14\0\4\147\7\0\15\147"+
+ "\1\u0209\14\147\1\0\3\147\6\0\1\147\4\0\3\147"+
+ "\1\0\3\147\1\u020a\13\0\2\147\1\u020b\1\147\7\0"+
+ "\32\147\1\0\3\147\6\0\1\147\4\0\3\147\1\0"+
+ "\3\147\1\334\13\0\2\147\1\335\1\147\7\0\15\147"+
+ "\1\u020c\14\147\1\0\3\147\6\0\1\147\13\0\4\u01d4"+
+ "\12\0\2\u01d4\6\0\1\u020d\125\0\1\u020e\106\0\1\u020f"+
+ "\74\0\1\u0210\111\0\1\u0211\145\0\1\u0212\11\0\4\u0213"+
+ "\12\0\2\u0213\57\0\13\u01a3\1\u01a4\14\u01a3\1\u01db\1\u0214"+
+ "\1\u01dd\1\u01de\1\u016b\1\u01a3\1\u016b\63\u01a3\1\u01a4\14\u01a3"+
+ "\1\u0215\1\u016b\55\u01a3\4\u01dd\1\u0216\4\u01dd\2\u01a3\1\u01a4"+
+ "\13\u01dd\1\u01a3\1\u0217\1\u01dd\1\u01a3\54\u01dd\4\u0218\1\u0219"+
+ "\4\u0218\2\u01a3\1\u01a4\13\u0218\1\u01a3\1\u021a\2\u0218\1\u016b"+
+ "\53\u0218\30\u01a4\1\u01df\1\u021b\1\u01e1\1\u01e2\1\232\1\u01a4"+
+ "\1\232\100\u01a4\1\u021c\1\u016b\55\u01a4\4\u01e1\1\u021d\4\u01e1"+
+ "\3\232\13\u01e1\1\232\1\u021e\1\u01e1\1\u01a4\54\u01e1\4\u021f"+
+ "\1\u0220\4\u021f\3\232\13\u021f\1\232\1\u0221\2\u021f\1\232"+
+ "\53\u021f\4\233\1\u01e3\1\233\1\u01e4\2\233\2\357\1\76"+
+ "\13\233\1\357\60\233\3\u01e5\3\233\1\u01e5\1\233\2\357"+
+ "\1\76\13\233\1\357\16\233\2\u01e5\3\233\1\u01e5\1\233"+
+ "\1\u01e5\1\233\1\u01e5\2\233\1\u01e5\1\233\4\u01e5\2\233"+
+ "\1\u01e5\1\233\1\u01e5\13\233\3\u0222\3\233\1\u0222\1\233"+
+ "\2\357\1\76\13\233\1\357\16\233\2\u0222\3\233\1\u0222"+
+ "\1\233\1\u0222\1\233\1\u0222\2\233\1\u0222\1\233\4\u0222"+
+ "\2\233\1\u0222\1\233\1\u0222\12\233\11\256\2\125\1\126"+
+ "\13\256\1\125\13\256\1\u0223\54\256\2\125\1\126\13\256"+
+ "\1\125\14\256\1\u0224\53\256\2\125\1\126\13\256\1\125"+
+ "\4\256\1\u0225\63\256\2\125\1\126\13\256\1\125\12\256"+
+ "\1\u0226\44\256\1\0\3\147\1\0\3\147\14\0\4\147"+
+ "\7\0\5\147\1\u0227\24\147\1\0\3\147\6\0\1\147"+
+ "\4\0\3\147\1\0\3\147\1\u0228\13\0\2\147\1\u0228"+
+ "\1\147\7\0\32\147\1\0\3\147\6\0\1\147\4\0"+
+ "\3\147\1\0\3\147\14\0\4\147\7\0\1\147\1\u0229"+
+ "\30\147\1\0\3\147\6\0\1\147\4\0\3\147\1\0"+
+ "\3\147\14\0\4\147\7\0\14\147\1\u022a\15\147\1\0"+
+ "\3\147\6\0\1\147\3\0\2\u022b\1\u022c\2\u022b\2\u022c"+
+ "\1\u022b\1\u01f4\3\0\10\u022b\1\u022c\1\u022b\1\u01f4\1\0"+
+ "\7\u022b\25\u022c\4\u022b\1\u022c\1\u022b\3\u022c\6\u022b\1\u022c"+
+ "\4\u022b\1\u022d\1\u022c\1\u022d\1\u022b\2\u022c\1\u022d\1\u01f4"+
+ "\3\0\10\u022b\1\u022c\1\u022d\1\u01f5\1\147\7\u022b\25\u022c"+
+ "\4\u022d\1\u022c\1\u022b\3\u022c\6\u022b\1\u022c\3\u022b\10\0"+
+ "\1\u01f6\3\0\1\u01f7\1\0\1\u01f8\1\0\1\u01f9\5\0"+
+ "\1\u01f6\62\0\1\u01bb\2\0\2\u01bb\1\0\1\u01f7\13\0"+
+ "\1\u01bb\1\0\1\u01f7\10\0\25\u01bb\4\0\1\u01bb\1\0"+
+ "\3\u01bb\6\0\1\u01bb\13\0\1\u01f8\6\0\1\u022e\6\0"+
+ "\1\u01f8\61\0\3\u022f\1\0\4\u022f\3\0\2\u022f\2\0"+
+ "\10\u022f\7\0\32\u022f\1\0\3\u022f\6\0\1\u022f\4\0"+
+ "\3\u01fa\1\0\4\u01fa\3\0\2\u01fa\2\0\1\u01fa\1\u0230"+
+ "\6\u01fa\7\0\32\u01fa\1\0\3\u01fa\6\0\1\u01fa\4\0"+
+ "\3\147\1\0\3\147\1\u0231\13\0\2\147\1\u0232\1\147"+
+ "\7\0\32\147\1\0\3\147\6\0\1\147\4\0\3\147"+
+ "\1\0\3\147\14\0\4\147\7\0\6\147\1\u0233\23\147"+
+ "\1\0\3\147\6\0\1\147\4\0\3\147\1\0\3\147"+
+ "\14\0\4\147\7\0\7\147\1\u0234\22\147\1\0\3\147"+
+ "\6\0\1\147\4\0\3\147\1\0\3\147\14\0\4\147"+
+ "\7\0\1\147\1\u0235\30\147\1\0\3\147\6\0\1\147"+
+ "\4\0\3\147\1\0\3\147\14\0\4\147\7\0\4\147"+
+ "\1\u0236\25\147\1\0\3\147\6\0\1\147\4\0\3\147"+
+ "\1\0\3\147\14\0\4\147\7\0\2\147\1\u0237\27\147"+
+ "\1\0\3\147\6\0\1\147\4\0\3\147\1\0\3\147"+
+ "\14\0\4\147\7\0\14\147\1\u0238\15\147\1\0\3\147"+
+ "\6\0\1\147\4\0\3\147\1\0\3\147\14\0\4\147"+
+ "\7\0\5\147\1\u0239\24\147\1\0\3\147\6\0\1\147"+
+ "\4\0\3\147\1\0\3\147\14\0\4\147\7\0\5\147"+
+ "\1\u023a\24\147\1\0\3\147\6\0\1\147\3\0\2\u023b"+
+ "\1\u023c\2\u023b\2\u023c\1\u023b\1\u0204\3\0\10\u023b\1\u023c"+
+ "\1\u023b\1\u0204\1\0\7\u023b\25\u023c\4\u023b\1\u023c\1\u023b"+
+ "\3\u023c\6\u023b\1\u023c\4\u023b\1\u023d\1\u023c\1\u023d\1\u023b"+
+ "\2\u023c\1\u023d\1\u0204\3\0\10\u023b\1\u023c\1\u023d\1\u0205"+
+ "\1\147\7\u023b\25\u023c\4\u023d\1\u023c\1\u023b\3\u023c\6\u023b"+
+ "\1\u023c\3\u023b\1\0\3\147\1\0\3\147\14\0\4\147"+
+ "\7\0\24\147\1\u023e\5\147\1\0\3\147\6\0\1\147"+
+ "\4\0\3\147\1\0\3\147\1\u023f\13\0\2\147\1\u0240"+
+ "\1\147\7\0\32\147\1\0\3\147\6\0\1\147\4\0"+
+ "\3\u0208\1\0\3\u0208\1\u0241\7\0\1\u0242\3\0\4\u0208"+
+ "\7\0\32\u0208\1\0\3\u0208\6\0\1\u0208\4\0\3\147"+
+ "\1\0\3\147\14\0\4\147\7\0\15\147\1\u0243\14\147"+
+ "\1\0\3\147\6\0\1\147\3\0\1\u0244\1\u0245\1\u0244"+
+ "\1\u0245\3\u0244\1\u0245\1\u020a\3\0\12\u0244\1\u020a\1\0"+
+ "\34\u0244\4\u0245\20\u0244\1\u0246\1\u0247\1\u0246\1\u0244\2\u0247"+
+ "\1\u0246\1\u020a\3\0\10\u0244\2\u0247\1\u020b\1\147\7\u0244"+
+ "\25\u0247\4\u0246\1\u0247\1\u0244\3\u0247\6\u0244\1\u0247\3\u0244"+
+ "\53\0\1\u0248\106\0\1\u0249\140\0\1\u024a\44\0\1\u024b"+
+ "\62\0\1\u024c\77\0\4\u0213\12\0\2\u0213\6\0\1\u024d"+
+ "\50\0\13\357\1\76\14\357\1\u01a3\1\u012d\1\u024e\1\u024f"+
+ "\53\357\11\u016b\2\u01a3\1\u01a4\13\u016b\1\u01a3\1\u01a5\1\u01a3"+
+ "\55\u016b\11\u01dd\2\u01a3\1\u01a4\13\u01dd\1\u01a3\1\u0217\62\u01dd"+
+ "\1\u0216\4\u01dd\2\u01a3\1\u01a4\13\u01dd\1\u01a3\1\u0217\1\u024e"+
+ "\1\u01a3\54\u01dd\11\u016b\2\u01a3\1\u01a4\13\u016b\1\u01a3\1\u01a5"+
+ "\2\u016b\1\u01a3\53\u016b\3\u0218\1\u0250\1\u0251\1\u0218\1\u0252"+
+ "\1\u0253\1\u0218\2\u01a3\1\u01a4\13\u0218\1\u01a3\1\u021a\33\u0218"+
+ "\1\u0250\1\u0218\1\u0253\1\u0250\17\u0218\11\u016b\2\u01a3\1\u01a4"+
+ "\13\u016b\1\u01a3\1\u01a5\1\357\1\u016b\1\u01a3\53\u016b\30\76"+
+ "\1\u01a4\1\u012d\1\u0254\1\u0255\53\76\30\232\1\356\1\u01a4"+
+ "\55\232\11\u01e1\3\232\13\u01e1\1\232\1\u021e\62\u01e1\1\u021d"+
+ "\4\u01e1\3\232\13\u01e1\1\232\1\u021e\1\u0254\1\u01a4\54\u01e1"+
+ "\30\232\1\356\2\232\1\u01a4\53\232\3\u021f\1\u0256\1\u0257"+
+ "\1\u021f\1\u0258\1\u0259\1\u021f\3\232\13\u021f\1\232\1\u0221"+
+ "\33\u021f\1\u0256\1\u021f\1\u0259\1\u0256\17\u021f\30\232\1\356"+
+ "\1\76\1\232\1\u01a4\53\232\1\233\3\u025a\3\233\1\u025a"+
+ "\1\233\2\357\1\76\13\233\1\357\16\233\2\u025a\3\233"+
+ "\1\u025a\1\233\1\u025a\1\233\1\u025a\2\233\1\u025a\1\233"+
+ "\4\u025a\2\233\1\u025a\1\233\1\u025a\12\233\11\256\2\125"+
+ "\1\126\13\256\1\125\14\256\1\u025b\53\256\2\125\1\126"+
+ "\13\256\1\125\15\256\1\u025c\41\256\11\u0225\2\u025d\1\u025e"+
+ "\13\u0225\1\u025d\57\u0225\11\256\2\125\1\126\13\256\1\125"+
+ "\13\256\1\u025f\43\256\1\0\3\147\1\0\3\147\14\0"+
+ "\4\147\7\0\6\147\1\u0260\23\147\1\0\3\147\6\0"+
+ "\1\147\3\0\13\u0228\1\0\73\u0228\1\0\3\147\1\0"+
+ "\3\147\14\0\4\147\7\0\2\147\1\u0261\27\147\1\0"+
+ "\3\147\6\0\1\147\4\0\3\147\1\0\3\147\14\0"+
+ "\4\147\7\0\15\147\1\u0262\14\147\1\0\3\147\6\0"+
+ "\1\147\3\0\11\u022b\3\0\13\u022b\1\0\60\u022b\3\u022c"+
+ "\1\u022b\3\u022c\1\u0263\3\0\2\u01f4\6\u022b\3\u022c\1\u0264"+
+ "\7\u022b\32\u022c\1\u022b\3\u022c\6\u022b\1\u022c\4\u022b\3\u022d"+
+ "\1\u022b\3\u022d\1\u022b\3\0\10\u022b\3\u022d\1\147\7\u022b"+
+ "\32\u022d\1\u022b\3\u022d\6\u022b\1\u022d\3\u022b\10\0\1\u022e"+
+ "\5\0\1\u01f8\7\0\1\u022e\61\0\3\u022f\1\0\4\u022f"+
+ "\3\0\2\u022f\2\0\1\u022f\1\u0265\6\u022f\7\0\32\u022f"+
+ "\1\0\3\u022f\6\0\1\u022f\4\0\1\u01fa\1\u0266\1\u01fa"+
+ "\1\0\2\u0266\1\u01fa\1\u0230\3\0\2\u01fa\2\0\1\u01fa"+
+ "\1\u0230\2\u01fa\1\u0266\1\u01fa\1\u0230\1\u01fa\7\0\25\u0266"+
+ "\4\u01fa\1\u0266\1\0\3\u0266\6\0\1\u0266\5\0\1\u0267"+
+ "\2\0\2\u0267\1\0\1\u0231\13\0\1\u0267\1\0\1\u0231"+
+ "\10\0\25\u0267\4\0\1\u0267\1\0\3\u0267\6\0\1\u0267"+
+ "\4\0\1\147\1\u0267\1\147\1\0\2\u0267\1\147\1\u0231"+
+ "\13\0\1\u0267\1\147\1\u0232\1\147\7\0\25\u0267\4\147"+
+ "\1\u0267\1\0\3\u0267\6\0\1\u0267\4\0\3\147\1\0"+
+ "\3\147\1\u0268\13\0\2\147\1\u0269\1\147\6\0\1\151"+
+ "\32\147\1\0\3\147\6\0\1\147\4\0\3\147\1\0"+
+ "\3\147\1\u026a\13\0\2\147\1\u026b\1\147\7\0\32\147"+
+ "\1\0\3\147\6\0\1\147\4\0\3\147\1\0\3\147"+
+ "\1\u026c\13\0\2\147\1\u026d\1\147\7\0\32\147\1\0"+
+ "\3\147\6\0\1\147\4\0\3\147\1\0\3\147\14\0"+
+ "\4\147\7\0\5\147\1\u026e\24\147\1\0\3\147\6\0"+
+ "\1\147\4\0\3\147\1\0\3\147\14\0\4\147\7\0"+
+ "\2\147\1\u026f\27\147\1\0\3\147\6\0\1\147\4\0"+
+ "\3\147\1\0\3\147\14\0\4\147\7\0\1\147\1\u0270"+
+ "\30\147\1\0\3\147\6\0\1\147\4\0\3\147\1\0"+
+ "\3\147\14\0\4\147\7\0\4\147\1\u0271\25\147\1\0"+
+ "\3\147\6\0\1\147\3\0\11\u023b\3\0\13\u023b\1\0"+
+ "\60\u023b\3\u023c\1\u023b\3\u023c\1\u0272\3\0\1\u0204\7\u023b"+
+ "\3\u023c\1\u0273\7\u023b\32\u023c\1\u023b\3\u023c\6\u023b\1\u023c"+
+ "\4\u023b\3\u023d\1\u023b\3\u023d\1\u023b\3\0\10\u023b\3\u023d"+
+ "\1\147\7\u023b\32\u023d\1\u023b\3\u023d\6\u023b\1\u023d\3\u023b"+
+ "\2\0\1\u0274\2\0\2\u0274\1\0\1\u023f\7\0\1\u0275"+
+ "\3\0\1\u0274\1\0\1\u023f\10\0\25\u0274\4\0\1\u0274"+
+ "\1\0\3\u0274\6\0\1\u0274\4\0\1\147\1\u0276\1\147"+
+ "\1\0\2\u0276\1\147\1\u023f\7\0\1\u0275\3\0\1\u0276"+
+ "\1\147\1\u0240\1\147\7\0\25\u0276\4\147\1\u0276\1\0"+
+ "\3\u0276\6\0\1\u0276\13\0\1\u0241\7\0\1\u0242\5\0"+
+ "\1\u0241\61\0\3\u0277\1\0\4\u0277\3\0\2\u0277\2\0"+
+ "\10\u0277\7\0\32\u0277\1\0\3\u0277\6\0\1\u0277\3\0"+
+ "\11\u0244\3\0\13\u0244\1\0\60\u0244\1\u0245\1\u0244\1\u0245"+
+ "\3\u0244\1\u0245\1\u0278\3\0\12\u0244\1\u0278\1\0\34\u0244"+
+ "\4\u0245\20\u0244\1\u0246\1\u0247\1\u0246\1\u0244\2\u0247\1\u0246"+
+ "\1\u0278\3\0\10\u0244\2\u0247\1\u0279\1\147\7\u0244\25\u0247"+
+ "\4\u0246\1\u0247\1\u0244\3\u0247\6\u0244\1\u0247\4\u0244\3\u0247"+
+ "\1\u0244\3\u0247\1\u0244\3\0\10\u0244\3\u0247\1\147\7\u0244"+
+ "\32\u0247\1\u0244\3\u0247\6\u0244\1\u0247\3\u0244\54\0\1\u027a"+
+ "\106\0\1\u027b\51\0\1\u027c\151\0\1\u027d\22\0\1\u027e"+
+ "\1\0\4\u024e\1\u027f\4\u024e\2\357\1\76\13\u024e\1\357"+
+ "\1\u024e\1\u0280\1\u024e\1\u0281\1\u012e\1\u024e\1\u012e\50\u024e"+
+ "\4\u0282\1\u0283\4\u0282\2\357\1\76\13\u0282\1\357\1\u0282"+
+ "\1\u012d\1\u0284\1\u012f\1\u016d\1\u0282\1\u016d\50\u0282\3\u016b"+
+ "\1\u0218\3\u016b\1\u0218\1\u016b\2\u01a3\1\u01a4\13\u016b\1\u01a3"+
+ "\1\u01a5\2\u016b\1\u01a3\30\u016b\1\u0218\1\u016b\2\u0218\23\u016b"+
+ "\1\u0285\1\u016b\1\u0286\2\u016b\2\u01a3\1\u01a4\13\u016b\1\u01a3"+
+ "\1\u01a5\2\u016b\1\u01a3\54\u016b\3\u0287\3\u016b\1\u0287\1\u016b"+
+ "\2\u01a3\1\u01a4\13\u016b\1\u01a3\1\u01a5\2\u016b\1\u01a3\12\u016b"+
+ "\2\u0287\3\u016b\1\u0287\1\u016b\1\u0287\1\u016b\1\u0287\2\u016b"+
+ "\1\u0287\1\u016b\4\u0287\2\u016b\1\u0287\1\u016b\1\u0287\15\u016b"+
+ "\1\u0250\3\u016b\1\u0250\1\u016b\2\u01a3\1\u01a4\13\u016b\1\u01a3"+
+ "\1\u01a5\2\u016b\1\u01a3\30\u016b\1\u0250\1\u016b\2\u0250\17\u016b"+
+ "\4\u0254\1\u0288\4\u0254\3\76\13\u0254\1\76\1\u0254\1\u0289"+
+ "\1\u0254\1\u028a\1\230\1\u0254\1\230\50\u0254\4\u028b\1\u028c"+
+ "\4\u028b\3\76\13\u028b\1\76\1\u028b\1\227\1\u028d\1\231"+
+ "\1\235\1\u028b\1\235\50\u028b\3\232\1\u021f\3\232\1\u021f"+
+ "\20\232\1\356\2\232\1\u01a4\30\232\1\u021f\1\232\2\u021f"+
+ "\23\232\1\u028e\1\232\1\u028f\21\232\1\356\2\232\1\u01a4"+
+ "\54\232\3\u0290\3\232\1\u0290\20\232\1\356\2\232\1\u01a4"+
+ "\12\232\2\u0290\3\232\1\u0290\1\232\1\u0290\1\232\1\u0290"+
+ "\2\232\1\u0290\1\232\4\u0290\2\232\1\u0290\1\232\1\u0290"+
+ "\15\232\1\u0256\3\232\1\u0256\20\232\1\356\2\232\1\u01a4"+
+ "\30\232\1\u0256\1\232\2\u0256\17\232\1\233\3\u016d\3\233"+
+ "\1\u016d\1\233\2\357\1\76\13\233\1\357\16\233\2\u016d"+
+ "\3\233\1\u016d\1\233\1\u016d\1\233\1\u016d\2\233\1\u016d"+
+ "\1\233\4\u016d\2\233\1\u016d\1\233\1\u016d\12\233\11\256"+
+ "\2\125\1\126\13\256\1\125\15\256\1\u0291\52\256\2\125"+
+ "\1\126\13\256\1\125\4\256\1\u0292\63\256\2\125\1\126"+
+ "\13\256\1\125\14\256\1\u0293\42\256\1\0\3\147\1\0"+
+ "\3\147\1\u0294\13\0\2\147\1\u0295\1\147\6\0\1\151"+
+ "\32\147\1\0\3\147\6\0\1\147\4\0\3\147\1\0"+
+ "\3\147\14\0\4\147\7\0\15\147\1\u0296\14\147\1\0"+
+ "\3\147\6\0\1\147\4\0\3\147\1\0\3\147\14\0"+
+ "\4\147\7\0\7\147\1\u0243\22\147\1\0\3\147\6\0"+
+ "\1\147\3\0\10\u022b\1\u0263\3\0\2\u01f4\10\u022b\1\u0263"+
+ "\1\0\57\u022b\1\0\3\u0264\1\0\3\u0264\1\u0297\3\0"+
+ "\2\u0298\6\0\4\u0264\7\0\32\u0264\1\0\3\u0264\6\0"+
+ "\1\u0264\4\0\3\u022f\1\0\3\u022f\1\u0265\3\0\2\u022f"+
+ "\1\u01f8\1\0\1\u022f\1\u0265\4\u022f\1\u0265\1\u022f\7\0"+
+ "\32\u022f\1\0\3\u022f\6\0\1\u022f\4\0\3\u0266\1\0"+
+ "\3\u0266\1\u0299\3\0\1\u0230\1\u01fa\1\u01f8\1\0\1\u029a"+
+ "\1\u0230\2\u01fa\4\u0266\7\0\32\u0266\1\0\3\u0266\6\0"+
+ "\1\u0266\4\0\3\u0267\1\0\3\u0267\1\u029b\3\0\1\u0231"+
+ "\3\0\1\u029c\3\0\4\u0267\7\0\32\u0267\1\0\3\u0267"+
+ "\6\0\1\u0267\3\0\2\u029d\1\u029e\2\u029d\2\u029e\1\u029d"+
+ "\1\u0268\3\0\10\u029d\1\u029e\1\u029d\1\u0268\1\0\7\u029d"+
+ "\25\u029e\4\u029d\1\u029e\1\u029d\3\u029e\6\u029d\1\u029e\4\u029d"+
+ "\1\u029f\1\u029e\1\u029f\1\u029d\2\u029e\1\u029f\1\u0268\3\0"+
+ "\10\u029d\1\u029e\1\u029f\1\u0269\1\147\7\u029d\25\u029e\4\u029f"+
+ "\1\u029e\1\u029d\3\u029e\6\u029d\1\u029e\3\u029d\10\0\1\u026a"+
+ "\15\0\1\u026a\12\0\1\u02a0\5\0\1\u02a1\40\0\3\147"+
+ "\1\0\3\147\1\u026a\13\0\2\147\1\u026b\1\147\7\0"+
+ "\2\147\1\u02a2\5\147\1\u02a3\21\147\1\0\3\147\6\0"+
+ "\1\147\5\0\1\u02a4\2\0\2\u02a4\1\0\1\u026c\13\0"+
+ "\1\u02a4\1\0\1\u026c\10\0\25\u02a4\4\0\1\u02a4\1\0"+
+ "\3\u02a4\6\0\1\u02a4\4\0\1\147\1\u02a4\1\147\1\0"+
+ "\2\u02a4\1\147\1\u026c\13\0\1\u02a4\1\147\1\u026d\1\147"+
+ "\7\0\25\u02a4\4\147\1\u02a4\1\0\3\u02a4\6\0\1\u02a4"+
+ "\4\0\3\147\1\0\3\147\14\0\4\147\7\0\6\147"+
+ "\1\u02a5\23\147\1\0\3\147\6\0\1\147\4\0\3\147"+
+ "\1\0\3\147\14\0\4\147\7\0\7\147\1\u02a6\22\147"+
+ "\1\0\3\147\6\0\1\147\4\0\3\147\1\0\3\147"+
+ "\14\0\4\147\7\0\7\147\1\u02a7\22\147\1\0\3\147"+
+ "\6\0\1\147\4\0\3\147\1\0\3\147\1\u02a8\13\0"+
+ "\2\147\1\u02a9\1\147\7\0\32\147\1\0\3\147\6\0"+
+ "\1\147\3\0\10\u023b\1\u0272\3\0\1\u0204\11\u023b\1\u0272"+
+ "\1\0\57\u023b\1\0\3\u0273\1\0\3\u0273\1\u02aa\3\0"+
+ "\1\u02ab\7\0\4\u0273\7\0\32\u0273\1\0\3\u0273\6\0"+
+ "\1\u0273\4\0\3\u0274\1\0\3\u0274\1\u02ac\3\0\1\u02ad"+
+ "\1\0\1\u02ae\1\0\1\u02af\3\0\2\u0274\1\u02b0\1\u0274"+
+ "\7\0\32\u0274\1\0\3\u0274\6\0\1\u0274\4\0\3\u02b1"+
+ "\1\0\4\u02b1\3\0\2\u02b1\2\0\10\u02b1\7\0\32\u02b1"+
+ "\1\0\3\u02b1\6\0\1\u02b1\4\0\3\u0276\1\0\3\u0276"+
+ "\1\u02ac\3\0\1\u02ad\1\0\1\u02ae\1\0\1\u02af\3\0"+
+ "\2\u0276\1\u02b2\1\u0276\7\0\32\u0276\1\0\3\u0276\6\0"+
+ "\1\u0276\4\0\3\u0277\1\0\4\u0277\3\0\2\u0277\2\0"+
+ "\1\u0277\1\u02b3\6\u0277\7\0\32\u0277\1\0\3\u0277\6\0"+
+ "\1\u0277\3\0\10\u0244\1\u0278\3\0\12\u0244\1\u0278\1\0"+
+ "\60\u0244\3\u0247\1\u0244\3\u0247\1\u0278\3\0\10\u0244\2\u0247"+
+ "\1\u0279\1\147\7\u0244\32\u0247\1\u0244\3\u0247\6\u0244\1\u0247"+
+ "\3\u0244\46\0\1\u02b4\106\0\1\u02b5\77\0\1\u02b6\66\0"+
+ "\1\u02b7\67\0\11\u024e\2\357\1\76\13\u024e\1\357\1\u024e"+
+ "\1\u0280\1\u012e\1\u0281\1\u012e\1\u024e\1\u012e\54\u024e\1\u027f"+
+ "\4\u024e\2\357\1\76\13\u024e\1\357\1\u01dd\1\u012e\1\357"+
+ "\54\u024e\4\u0284\1\u02b8\4\u0284\2\357\1\76\13\u0284\1\357"+
+ "\2\u0284\1\u0282\1\u012e\53\u0284\13\357\1\76\15\357\1\u012d"+
+ "\1\u012e\1\u024f\1\233\1\357\1\233\50\357\3\u0282\1\u02b9"+
+ "\1\u02ba\1\u0282\1\u02bb\1\u02bc\1\u0282\2\357\1\76\13\u0282"+
+ "\1\357\1\u0282\1\u012d\1\u0284\1\u02bd\1\u016d\1\u0282\1\u016d"+
+ "\25\u0282\1\u02b9\1\u0282\1\u02bc\1\u02b9\17\u0282\4\u012e\1\u016c"+
+ "\4\u012e\2\357\1\76\13\u012e\1\357\2\u012e\1\357\1\u024e"+
+ "\53\u012e\4\u016b\1\u0285\1\u016b\1\u0286\2\u016b\2\u01a3\1\u01a4"+
+ "\13\u016b\1\u01a3\1\u01a5\57\u016b\3\u0287\3\u016b\1\u0287\1\u016b"+
+ "\2\u01a3\1\u01a4\13\u016b\1\u01a3\1\u01a5\15\u016b\2\u0287\3\u016b"+
+ "\1\u0287\1\u016b\1\u0287\1\u016b\1\u0287\2\u016b\1\u0287\1\u016b"+
+ "\4\u0287\2\u016b\1\u0287\1\u016b\1\u0287\13\u016b\3\u02be\3\u016b"+
+ "\1\u02be\1\u016b\2\u01a3\1\u01a4\13\u016b\1\u01a3\1\u01a5\15\u016b"+
+ "\2\u02be\3\u016b\1\u02be\1\u016b\1\u02be\1\u016b\1\u02be\2\u016b"+
+ "\1\u02be\1\u016b\4\u02be\2\u016b\1\u02be\1\u016b\1\u02be\12\u016b"+
+ "\11\u0254\3\76\13\u0254\1\76\1\u0254\1\u0289\1\230\1\u028a"+
+ "\1\230\1\u0254\1\230\54\u0254\1\u0288\4\u0254\3\76\13\u0254"+
+ "\1\76\1\u01e1\1\u012e\1\76\54\u0254\4\u028d\1\u02bf\4\u028d"+
+ "\3\0\13\u028d\1\0\2\u028d\1\u028b\1\230\53\u028d\31\76"+
+ "\1\227\1\230\1\u0255\1\0\1\76\1\0\50\76\3\u028b"+
+ "\1\u02c0\1\u02c1\1\u028b\1\u02c2\1\u02c3\1\u028b\3\76\13\u028b"+
+ "\1\76\1\u028b\1\227\1\u028d\1\u02c4\1\235\1\u028b\1\235"+
+ "\25\u028b\1\u02c0\1\u028b\1\u02c3\1\u02c0\17\u028b\4\230\1\234"+
+ "\4\230\3\0\13\230\1\0\2\230\1\76\1\u0254\53\230"+
+ "\4\232\1\u028e\1\232\1\u028f\21\232\1\356\57\232\3\u0290"+
+ "\3\232\1\u0290\20\232\1\356\15\232\2\u0290\3\232\1\u0290"+
+ "\1\232\1\u0290\1\232\1\u0290\2\232\1\u0290\1\232\4\u0290"+
+ "\2\232\1\u0290\1\232\1\u0290\13\232\3\u02c5\3\232\1\u02c5"+
+ "\20\232\1\356\15\232\2\u02c5\3\232\1\u02c5\1\232\1\u02c5"+
+ "\1\232\1\u02c5\2\232\1\u02c5\1\232\4\u02c5\2\232\1\u02c5"+
+ "\1\232\1\u02c5\12\232\11\256\2\125\1\126\13\256\1\125"+
+ "\4\256\1\u02c6\52\256\11\u0292\2\u02c7\1\u02c8\13\u0292\1\u02c7"+
+ "\57\u0292\11\256\2\125\1\126\13\256\1\125\15\256\1\u02c9"+
+ "\41\256\2\u02ca\1\u02cb\2\u02ca\2\u02cb\1\u02ca\1\u0294\3\0"+
+ "\10\u02ca\1\u02cb\1\u02ca\1\u0294\1\0\7\u02ca\25\u02cb\4\u02ca"+
+ "\1\u02cb\1\u02ca\3\u02cb\6\u02ca\1\u02cb\4\u02ca\1\u02cc\1\u02cb"+
+ "\1\u02cc\1\u02ca\2\u02cb\1\u02cc\1\u0294\3\0\10\u02ca\1\u02cb"+
+ "\1\u02cc\1\u0295\1\147\7\u02ca\25\u02cb\4\u02cc\1\u02cb\1\u02ca"+
+ "\3\u02cb\6\u02ca\1\u02cb\3\u02ca\1\0\3\147\1\0\3\147"+
+ "\1\u02cd\13\0\2\147\1\u02cd\1\147\7\0\32\147\1\0"+
+ "\3\147\6\0\1\147\13\0\1\u0297\3\0\2\u0298\10\0"+
+ "\1\u0297\62\0\1\u0264\2\0\2\u0264\1\0\1\u0298\13\0"+
+ "\1\u0264\1\0\1\u0298\10\0\25\u0264\4\0\1\u0264\1\0"+
+ "\3\u0264\6\0\1\u0264\4\0\3\u01fa\1\0\3\u01fa\1\u0299"+
+ "\3\0\1\u0230\1\u01fa\1\u01f8\1\0\1\u029a\1\u0230\4\u01fa"+
+ "\1\u0299\1\u01fa\7\0\32\u01fa\1\0\3\u01fa\6\0\1\u01fa"+
+ "\4\0\3\u02ce\1\0\4\u02ce\3\0\2\u02ce\2\0\1\u02ce"+
+ "\1\u02cf\6\u02ce\7\0\32\u02ce\1\0\3\u02ce\6\0\1\u02ce"+
+ "\13\0\1\u029b\3\0\1\u0231\3\0\1\u029c\5\0\1\u029b"+
+ "\61\0\3\u02d0\1\0\4\u02d0\3\0\2\u02d0\2\0\10\u02d0"+
+ "\7\0\32\u02d0\1\0\3\u02d0\6\0\1\u02d0\3\0\11\u029d"+
+ "\3\0\13\u029d\1\0\60\u029d\3\u029e\1\u029d\3\u029e\1\u02d1"+
+ "\3\0\2\u0268\6\u029d\3\u029e\1\u02d2\7\u029d\32\u029e\1\u029d"+
+ "\3\u029e\6\u029d\1\u029e\4\u029d\3\u029f\1\u029d\3\u029f\1\u029d"+
+ "\3\0\10\u029d\3\u029f\1\147\7\u029d\32\u029f\1\u029d\3\u029f"+
+ "\6\u029d\1\u029f\3\u029d\43\0\1\u02d3\116\0\1\u02d4\34\0"+
+ "\3\147\1\0\3\147\14\0\4\147\7\0\4\147\1\u02d5"+
+ "\25\147\1\0\3\147\6\0\1\147\4\0\3\147\1\0"+
+ "\3\147\14\0\4\147\7\0\14\147\1\u02d6\15\147\1\0"+
+ "\3\147\6\0\1\147\4\0\3\u02a4\1\0\3\u02a4\1\u02d7"+
+ "\13\0\4\u02a4\7\0\32\u02a4\1\0\3\u02a4\6\0\1\u02a4"+
+ "\4\0\3\147\1\0\3\147\1\u02d8\13\0\2\147\1\u02d9"+
+ "\1\147\6\0\1\151\32\147\1\0\3\147\6\0\1\147"+
+ "\3\0\2\u02da\1\u02db\2\u02da\2\u02db\1\u02da\1\u02a8\3\0"+
+ "\10\u02da\1\u02db\1\u02da\1\u02a8\1\0\7\u02da\25\u02db\4\u02da"+
+ "\1\u02db\1\u02da\3\u02db\6\u02da\1\u02db\4\u02da\1\u02dc\1\u02db"+
+ "\1\u02dc\1\u02da\2\u02db\1\u02dc\1\u02a8\3\0\10\u02da\1\u02db"+
+ "\1\u02dc\1\u02a9\1\147\7\u02da\25\u02db\4\u02dc\1\u02db\1\u02da"+
+ "\3\u02db\6\u02da\1\u02db\3\u02da\10\0\1\u02aa\3\0\1\u02ab"+
+ "\11\0\1\u02aa\62\0\1\u0273\2\0\2\u0273\1\0\1\u02ab"+
+ "\13\0\1\u0273\1\0\1\u02ab\10\0\25\u0273\4\0\1\u0273"+
+ "\1\0\3\u0273\6\0\1\u0273\13\0\1\u02ac\3\0\1\u02ad"+
+ "\1\0\1\u02ae\1\0\1\u02af\5\0\1\u02ac\62\0\1\u0274"+
+ "\2\0\2\u0274\1\0\1\u02ad\13\0\1\u0274\1\0\1\u02ad"+
+ "\10\0\25\u0274\4\0\1\u0274\1\0\3\u0274\6\0\1\u0274"+
+ "\13\0\1\u02ae\6\0\1\u02dd\6\0\1\u02ae\61\0\3\u02de"+
+ "\1\0\4\u02de\3\0\2\u02de\2\0\10\u02de\7\0\32\u02de"+
+ "\1\0\3\u02de\6\0\1\u02de\4\0\3\u02b1\1\0\4\u02b1"+
+ "\3\0\2\u02b1\2\0\1\u02b1\1\u02df\6\u02b1\7\0\32\u02b1"+
+ "\1\0\3\u02b1\6\0\1\u02b1\4\0\3\u0277\1\0\3\u0277"+
+ "\1\u02b3\3\0\2\u0277\2\0\1\u0277\1\u02b3\4\u0277\1\u02b3"+
+ "\1\u0277\7\0\32\u0277\1\0\3\u0277\6\0\1\u0277\110\0"+
+ "\1\u02e0\106\0\1\u02e1\64\0\1\u02e2\23\0\3\u0284\1\u02e3"+
+ "\1\u02e4\1\u0284\1\u02e5\1\u02e6\1\u0284\2\357\1\76\13\u0284"+
+ "\1\357\34\u0284\1\u02e3\1\u0284\1\u02e6\1\u02e3\17\u0284\3\357"+
+ "\1\u0282\3\357\1\u0282\3\357\1\76\15\357\1\u012d\1\u012e"+
+ "\1\u024f\1\233\1\357\1\233\25\357\1\u0282\1\357\2\u0282"+
+ "\23\357\1\u02e7\1\357\1\u02e8\4\357\1\76\15\357\1\u012d"+
+ "\1\u012e\1\u024f\1\233\1\357\1\233\51\357\3\u02e9\3\357"+
+ "\1\u02e9\3\357\1\76\15\357\1\u012d\1\u012e\1\u024f\1\233"+
+ "\1\357\1\233\7\357\2\u02e9\3\357\1\u02e9\1\357\1\u02e9"+
+ "\1\357\1\u02e9\2\357\1\u02e9\1\357\4\u02e9\2\357\1\u02e9"+
+ "\1\357\1\u02e9\15\357\1\u02b9\3\357\1\u02b9\3\357\1\76"+
+ "\15\357\1\u012d\1\u012e\1\u024f\1\233\1\357\1\233\25\357"+
+ "\1\u02b9\1\357\2\u02b9\17\357\4\u016d\1\u016e\4\u016d\2\357"+
+ "\1\76\13\u016d\1\357\3\u016d\1\357\53\u016d\1\u016b\3\u02ea"+
+ "\3\u016b\1\u02ea\1\u016b\2\u01a3\1\u01a4\13\u016b\1\u01a3\1\u01a5"+
+ "\15\u016b\2\u02ea\3\u016b\1\u02ea\1\u016b\1\u02ea\1\u016b\1\u02ea"+
+ "\2\u016b\1\u02ea\1\u016b\4\u02ea\2\u016b\1\u02ea\1\u016b\1\u02ea"+
+ "\12\u016b\3\u028d\1\u02eb\1\u02ec\1\u028d\1\u02ed\1\u02ee\1\u028d"+
+ "\3\0\13\u028d\1\0\34\u028d\1\u02eb\1\u028d\1\u02ee\1\u02eb"+
+ "\17\u028d\3\76\1\u028b\3\76\1\u028b\21\76\1\227\1\230"+
+ "\1\u0255\1\0\1\76\1\0\25\76\1\u028b\1\76\2\u028b"+
+ "\23\76\1\u02ef\1\76\1\u02f0\22\76\1\227\1\230\1\u0255"+
+ "\1\0\1\76\1\0\51\76\3\u02f1\3\76\1\u02f1\21\76"+
+ "\1\227\1\230\1\u0255\1\0\1\76\1\0\7\76\2\u02f1"+
+ "\3\76\1\u02f1\1\76\1\u02f1\1\76\1\u02f1\2\76\1\u02f1"+
+ "\1\76\4\u02f1\2\76\1\u02f1\1\76\1\u02f1\15\76\1\u02c0"+
+ "\3\76\1\u02c0\21\76\1\227\1\230\1\u0255\1\0\1\76"+
+ "\1\0\25\76\1\u02c0\1\76\2\u02c0\17\76\4\235\1\236"+
+ "\4\235\3\0\13\235\1\0\3\235\1\76\53\235\1\232"+
+ "\3\u02f2\3\232\1\u02f2\20\232\1\356\15\232\2\u02f2\3\232"+
+ "\1\u02f2\1\232\1\u02f2\1\232\1\u02f2\2\232\1\u02f2\1\232"+
+ "\4\u02f2\2\232\1\u02f2\1\232\1\u02f2\12\232\11\u02c6\2\u02f3"+
+ "\1\u02f4\13\u02c6\1\u02f3\57\u02c6\11\256\2\125\1\126\13\256"+
+ "\1\125\4\256\1\u02f5\52\256\11\u02ca\3\0\13\u02ca\1\0"+
+ "\60\u02ca\3\u02cb\1\u02ca\3\u02cb\1\u02f6\3\0\2\u0294\6\u02ca"+
+ "\3\u02cb\1\u02f7\7\u02ca\32\u02cb\1\u02ca\3\u02cb\6\u02ca\1\u02cb"+
+ "\4\u02ca\3\u02cc\1\u02ca\3\u02cc\1\u02ca\3\0\10\u02ca\3\u02cc"+
+ "\1\147\7\u02ca\32\u02cc\1\u02ca\3\u02cc\6\u02ca\1\u02cc\3\u02ca"+
+ "\13\u02cd\1\0\73\u02cd\1\0\3\u02ce\1\0\4\u02ce\3\0"+
+ "\2\u02ce\2\0\1\u02ce\1\u02f8\6\u02ce\7\0\32\u02ce\1\0"+
+ "\3\u02ce\6\0\1\u02ce\4\0\1\u02ce\1\u02f9\1\u02ce\1\0"+
+ "\2\u02f9\1\u02ce\1\u02cf\3\0\2\u02ce\2\0\1\u02ce\1\u02f8"+
+ "\2\u02ce\1\u02f9\1\u02ce\1\u02cf\1\u02ce\7\0\25\u02f9\4\u02ce"+
+ "\1\u02f9\1\0\3\u02f9\6\0\1\u02f9\4\0\3\u02d0\1\0"+
+ "\4\u02d0\3\0\2\u02d0\2\0\1\u02d0\1\u02fa\6\u02d0\7\0"+
+ "\32\u02d0\1\0\3\u02d0\6\0\1\u02d0\3\0\10\u029d\1\u02d1"+
+ "\3\0\2\u0268\10\u029d\1\u02d1\1\0\57\u029d\1\0\3\u02d2"+
+ "\1\0\3\u02d2\1\u02fb\3\0\2\u02fc\6\0\4\u02d2\7\0"+
+ "\32\u02d2\1\0\3\u02d2\6\0\1\u02d2\11\0\1\u02fd\151\0"+
+ "\1\u02fe\36\0\3\147\1\0\1\147\1\u02ff\1\147\14\0"+
+ "\4\147\7\0\32\147\1\0\3\147\6\0\1\147\4\0"+
+ "\3\147\1\0\3\147\14\0\4\147\7\0\12\147\1\u0300"+
+ "\17\147\1\0\3\147\6\0\1\147\13\0\1\u02d7\15\0"+
+ "\1\u02d7\60\0\2\u0301\1\u0302\2\u0301\2\u0302\1\u0301\1\u02d8"+
+ "\3\0\10\u0301\1\u0302\1\u0301\1\u02d8\1\0\7\u0301\25\u0302"+
+ "\4\u0301\1\u0302\1\u0301\3\u0302\6\u0301\1\u0302\4\u0301\1\u0303"+
+ "\1\u0302\1\u0303\1\u0301\2\u0302\1\u0303\1\u02d8\3\0\10\u0301"+
+ "\1\u0302\1\u0303\1\u02d9\1\147\7\u0301\25\u0302\4\u0303\1\u0302"+
+ "\1\u0301\3\u0302\6\u0301\1\u0302\3\u0301\11\u02da\3\0\13\u02da"+
+ "\1\0\60\u02da\3\u02db\1\u02da\3\u02db\1\u0304\3\0\1\u02a8"+
+ "\7\u02da\3\u02db\1\u0305\7\u02da\32\u02db\1\u02da\3\u02db\6\u02da"+
+ "\1\u02db\4\u02da\3\u02dc\1\u02da\3\u02dc\1\u02da\3\0\10\u02da"+
+ "\3\u02dc\1\147\7\u02da\32\u02dc\1\u02da\3\u02dc\6\u02da\1\u02dc"+
+ "\3\u02da\10\0\1\u0306\5\0\1\u02ae\7\0\1\u0306\61\0"+
+ "\3\u02de\1\0\4\u02de\3\0\2\u02de\2\0\1\u02de\1\u0307"+
+ "\6\u02de\7\0\32\u02de\1\0\3\u02de\6\0\1\u02de\4\0"+
+ "\1\u02b1\1\u0308\1\u02b1\1\0\2\u0308\1\u02b1\1\u02df\3\0"+
+ "\2\u02b1\2\0\1\u02b1\1\u02df\2\u02b1\1\u0308\1\u02b1\1\u02df"+
+ "\1\u02b1\7\0\25\u0308\4\u02b1\1\u0308\1\0\3\u0308\6\0"+
+ "\1\u0308\22\0\1\u0309\106\0\1\u030a\126\0\1\u030b\47\0"+
+ "\3\u012e\1\u0284\1\u016c\2\u012e\1\u0284\1\u012e\2\357\1\76"+
+ "\13\u012e\1\357\2\u012e\1\357\1\u024e\30\u012e\1\u0284\1\u012e"+
+ "\2\u0284\23\u012e\1\u030c\1\u012e\1\u030d\2\u012e\2\357\1\76"+
+ "\13\u012e\1\357\2\u012e\1\357\1\u024e\54\u012e\3\u030e\1\u016c"+
+ "\2\u012e\1\u030e\1\u012e\2\357\1\76\13\u012e\1\357\2\u012e"+
+ "\1\357\1\u024e\12\u012e\2\u030e\3\u012e\1\u030e\1\u012e\1\u030e"+
+ "\1\u012e\1\u030e\2\u012e\1\u030e\1\u012e\4\u030e\2\u012e\1\u030e"+
+ "\1\u012e\1\u030e\15\u012e\1\u02e3\1\u016c\2\u012e\1\u02e3\1\u012e"+
+ "\2\357\1\76\13\u012e\1\357\2\u012e\1\357\1\u024e\30\u012e"+
+ "\1\u02e3\1\u012e\2\u02e3\17\u012e\4\357\1\u02e7\1\357\1\u02e8"+
+ "\4\357\1\76\15\357\1\u012d\1\u012e\1\u012f\1\233\1\357"+
+ "\1\233\51\357\3\u02e9\3\357\1\u02e9\3\357\1\76\15\357"+
+ "\1\u012d\1\u012e\1\u012f\1\233\1\357\1\233\7\357\2\u02e9"+
+ "\3\357\1\u02e9\1\357\1\u02e9\1\357\1\u02e9\2\357\1\u02e9"+
+ "\1\357\4\u02e9\2\357\1\u02e9\1\357\1\u02e9\13\357\3\u030f"+
+ "\3\357\1\u030f\3\357\1\76\15\357\1\u012d\1\u012e\1\u012f"+
+ "\1\233\1\357\1\233\7\357\2\u030f\3\357\1\u030f\1\357"+
+ "\1\u030f\1\357\1\u030f\2\357\1\u030f\1\357\4\u030f\2\357"+
+ "\1\u030f\1\357\1\u030f\12\357\1\u016b\3\u0218\3\u016b\1\u0218"+
+ "\1\u016b\2\u01a3\1\u01a4\13\u016b\1\u01a3\1\u01a5\15\u016b\2\u0218"+
+ "\3\u016b\1\u0218\1\u016b\1\u0218\1\u016b\1\u0218\2\u016b\1\u0218"+
+ "\1\u016b\4\u0218\2\u016b\1\u0218\1\u016b\1\u0218\12\u016b\3\230"+
+ "\1\u028d\1\234\2\230\1\u028d\1\230\3\0\13\230\1\0"+
+ "\2\230\1\76\1\u0254\30\230\1\u028d\1\230\2\u028d\23\230"+
+ "\1\u0310\1\230\1\u0311\2\230\3\0\13\230\1\0\2\230"+
+ "\1\76\1\u0254\54\230\3\u0312\1\234\2\230\1\u0312\1\230"+
+ "\3\0\13\230\1\0\2\230\1\76\1\u0254\12\230\2\u0312"+
+ "\3\230\1\u0312\1\230\1\u0312\1\230\1\u0312\2\230\1\u0312"+
+ "\1\230\4\u0312\2\230\1\u0312\1\230\1\u0312\15\230\1\u02eb"+
+ "\1\234\2\230\1\u02eb\1\230\3\0\13\230\1\0\2\230"+
+ "\1\76\1\u0254\30\230\1\u02eb\1\230\2\u02eb\17\230\4\76"+
+ "\1\u02ef\1\76\1\u02f0\22\76\1\227\1\230\1\231\1\0"+
+ "\1\76\1\0\51\76\3\u02f1\3\76\1\u02f1\21\76\1\227"+
+ "\1\230\1\231\1\0\1\76\1\0\7\76\2\u02f1\3\76"+
+ "\1\u02f1\1\76\1\u02f1\1\76\1\u02f1\2\76\1\u02f1\1\76"+
+ "\4\u02f1\2\76\1\u02f1\1\76\1\u02f1\13\76\3\u0313\3\76"+
+ "\1\u0313\21\76\1\227\1\230\1\231\1\0\1\76\1\0"+
+ "\7\76\2\u0313\3\76\1\u0313\1\76\1\u0313\1\76\1\u0313"+
+ "\2\76\1\u0313\1\76\4\u0313\2\76\1\u0313\1\76\1\u0313"+
+ "\12\76\1\232\3\u021f\3\232\1\u021f\20\232\1\356\15\232"+
+ "\2\u021f\3\232\1\u021f\1\232\1\u021f\1\232\1\u021f\2\232"+
+ "\1\u021f\1\232\4\u021f\2\232\1\u021f\1\232\1\u021f\12\232"+
+ "\11\u02f5\2\u0314\1\u0315\13\u02f5\1\u0314\57\u02f5\10\u02ca\1\u02f6"+
+ "\3\0\2\u0294\10\u02ca\1\u02f6\1\0\57\u02ca\1\0\3\u02f7"+
+ "\1\0\3\u02f7\1\u0316\3\0\2\u0317\6\0\4\u02f7\7\0"+
+ "\32\u02f7\1\0\3\u02f7\6\0\1\u02f7\4\0\1\u02ce\1\u02f9"+
+ "\1\u02ce\1\0\2\u02f9\1\u02ce\1\u02f8\3\0\2\u02ce\1\u01f8"+
+ "\1\0\1\u02ce\1\u02f8\2\u02ce\1\u02f9\1\u02ce\1\u02f8\1\u02ce"+
+ "\7\0\25\u02f9\4\u02ce\1\u02f9\1\0\3\u02f9\6\0\1\u02f9"+
+ "\4\0\3\u02f9\1\0\3\u02f9\1\u0318\3\0\1\u02cf\1\u02ce"+
+ "\1\u01f8\1\0\1\u02ce\1\u02f8\2\u02ce\4\u02f9\7\0\32\u02f9"+
+ "\1\0\3\u02f9\6\0\1\u02f9\4\0\3\u02d0\1\0\3\u02d0"+
+ "\1\u02fa\3\0\2\u02d0\2\0\1\u02d0\1\u02fa\4\u02d0\1\u02fa"+
+ "\1\u02d0\7\0\32\u02d0\1\0\3\u02d0\6\0\1\u02d0\13\0"+
+ "\1\u02fb\3\0\2\u02fc\10\0\1\u02fb\62\0\1\u02d2\2\0"+
+ "\2\u02d2\1\0\1\u02fc\13\0\1\u02d2\1\0\1\u02fc\10\0"+
+ "\25\u02d2\4\0\1\u02d2\1\0\3\u02d2\6\0\1\u02d2\51\0"+
+ "\1\u0319\114\0\1\u031a\33\0\3\147\1\0\3\147\14\0"+
+ "\4\147\7\0\7\147\1\u031b\22\147\1\0\3\147\6\0"+
+ "\1\147\4\0\3\147\1\0\3\147\14\0\4\147\7\0"+
+ "\15\147\1\u031c\14\147\1\0\3\147\6\0\1\147\3\0"+
+ "\11\u0301\3\0\13\u0301\1\0\60\u0301\3\u0302\1\u0301\3\u0302"+
+ "\1\u031d\3\0\2\u02d8\6\u0301\3\u0302\1\u031e\7\u0301\32\u0302"+
+ "\1\u0301\3\u0302\6\u0301\1\u0302\4\u0301\3\u0303\1\u0301\3\u0303"+
+ "\1\u0301\3\0\10\u0301\3\u0303\1\147\7\u0301\32\u0303\1\u0301"+
+ "\3\u0303\6\u0301\1\u0303\3\u0301\10\u02da\1\u0304\3\0\1\u02a8"+
+ "\11\u02da\1\u0304\1\0\57\u02da\1\0\3\u0305\1\0\3\u0305"+
+ "\1\u031f\3\0\1\u0320\7\0\4\u0305\7\0\32\u0305\1\0"+
+ "\3\u0305\6\0\1\u0305\4\0\3\u02de\1\0\3\u02de\1\u0321"+
+ "\3\0\2\u02de\1\u02ae\1\0\1\u02de\1\u0307\4\u02de\1\u0321"+
+ "\1\u02de\7\0\32\u02de\1\0\3\u02de\6\0\1\u02de\4\0"+
+ "\3\u0308\1\0\3\u0308\1\u0322\3\0\1\u02df\1\u02b1\1\u02ae"+
+ "\1\0\1\u0323\1\u02df\2\u02b1\2\u0308\1\u0324\1\u0308\7\0"+
+ "\32\u0308\1\0\3\u0308\6\0\1\u0308\44\0\1\u0325\45\0"+
+ "\4\u012e\1\u0326\1\u012e\1\u030d\2\u012e\2\357\1\76\13\u012e"+
+ "\1\357\60\u012e\3\u030e\1\u016c\2\u012e\1\u030e\1\u012e\2\357"+
+ "\1\76\13\u012e\1\357\2\u012e\1\357\13\u012e\2\u030e\3\u012e"+
+ "\1\u030e\1\u012e\1\u030e\1\u012e\1\u030e\2\u012e\1\u030e\1\u012e"+
+ "\4\u030e\2\u012e\1\u030e\1\u012e\1\u030e\13\u012e\3\u0327\1\u016c"+
+ "\2\u012e\1\u0327\1\u012e\2\357\1\76\13\u012e\1\357\2\u012e"+
+ "\1\357\13\u012e\2\u0327\3\u012e\1\u0327\1\u012e\1\u0327\1\u012e"+
+ "\1\u0327\2\u012e\1\u0327\1\u012e\4\u0327\2\u012e\1\u0327\1\u012e"+
+ "\1\u0327\12\u012e\1\357\3\u0328\3\357\1\u0328\3\357\1\76"+
+ "\15\357\1\u012d\1\u012e\1\u012f\1\233\1\357\1\233\7\357"+
+ "\2\u0328\3\357\1\u0328\1\357\1\u0328\1\357\1\u0328\2\357"+
+ "\1\u0328\1\357\4\u0328\2\357\1\u0328\1\357\1\u0328\12\357"+
+ "\4\230\1\u0329\1\230\1\u0311\2\230\3\0\13\230\1\0"+
+ "\60\230\3\u0312\1\234\2\230\1\u0312\1\230\3\0\13\230"+
+ "\1\0\2\230\1\76\13\230\2\u0312\3\230\1\u0312\1\230"+
+ "\1\u0312\1\230\1\u0312\2\230\1\u0312\1\230\4\u0312\2\230"+
+ "\1\u0312\1\230\1\u0312\13\230\3\u032a\1\234\2\230\1\u032a"+
+ "\1\230\3\0\13\230\1\0\2\230\1\76\13\230\2\u032a"+
+ "\3\230\1\u032a\1\230\1\u032a\1\230\1\u032a\2\230\1\u032a"+
+ "\1\230\4\u032a\2\230\1\u032a\1\230\1\u032a\12\230\1\76"+
+ "\3\u032b\3\76\1\u032b\21\76\1\227\1\230\1\231\1\0"+
+ "\1\76\1\0\7\76\2\u032b\3\76\1\u032b\1\76\1\u032b"+
+ "\1\76\1\u032b\2\76\1\u032b\1\76\4\u032b\2\76\1\u032b"+
+ "\1\76\1\u032b\12\76\10\0\1\u0316\3\0\2\u0317\10\0"+
+ "\1\u0316\62\0\1\u02f7\2\0\2\u02f7\1\0\1\u0317\13\0"+
+ "\1\u02f7\1\0\1\u0317\10\0\25\u02f7\4\0\1\u02f7\1\0"+
+ "\3\u02f7\6\0\1\u02f7\4\0\3\u02ce\1\0\3\u02ce\1\u0318"+
+ "\3\0\1\u02cf\1\u02ce\1\u01f8\1\0\1\u02ce\1\u02f8\4\u02ce"+
+ "\1\u0318\1\u02ce\7\0\32\u02ce\1\0\3\u02ce\6\0\1\u02ce"+
+ "\51\0\1\u032c\41\0\3\147\1\0\3\147\14\0\4\147"+
+ "\7\0\7\147\1\u032d\22\147\1\0\3\147\6\0\1\147"+
+ "\3\0\10\u0301\1\u031d\3\0\2\u02d8\10\u0301\1\u031d\1\0"+
+ "\57\u0301\1\0\3\u031e\1\0\3\u031e\1\u032e\3\0\2\u032f"+
+ "\6\0\4\u031e\7\0\32\u031e\1\0\3\u031e\6\0\1\u031e"+
+ "\13\0\1\u031f\3\0\1\u0320\11\0\1\u031f\62\0\1\u0305"+
+ "\2\0\2\u0305\1\0\1\u0320\13\0\1\u0305\1\0\1\u0320"+
+ "\10\0\25\u0305\4\0\1\u0305\1\0\3\u0305\6\0\1\u0305"+
+ "\4\0\3\u02b1\1\0\3\u02b1\1\u0322\3\0\1\u02df\1\u02b1"+
+ "\1\u02ae\1\0\1\u0323\1\u02df\4\u02b1\1\u0322\1\u02b1\7\0"+
+ "\32\u02b1\1\0\3\u02b1\6\0\1\u02b1\4\0\3\u0330\1\0"+
+ "\4\u0330\3\0\2\u0330\2\0\1\u0330\1\u0331\6\u0330\7\0"+
+ "\32\u0330\1\0\3\u0330\6\0\1\u0330\110\0\1\u0332\1\0"+
+ "\4\u012e\1\u030c\1\u012e\1\u030d\2\u012e\2\357\1\76\13\u012e"+
+ "\1\357\2\u012e\1\357\55\u012e\3\u0333\1\u016c\2\u012e\1\u0333"+
+ "\1\u012e\2\357\1\76\13\u012e\1\357\2\u012e\1\357\13\u012e"+
+ "\2\u0333\3\u012e\1\u0333\1\u012e\1\u0333\1\u012e\1\u0333\2\u012e"+
+ "\1\u0333\1\u012e\4\u0333\2\u012e\1\u0333\1\u012e\1\u0333\12\u012e"+
+ "\1\357\3\u0282\3\357\1\u0282\3\357\1\76\15\357\1\u012d"+
+ "\1\u012e\1\u012f\1\233\1\357\1\233\7\357\2\u0282\3\357"+
+ "\1\u0282\1\357\1\u0282\1\357\1\u0282\2\357\1\u0282\1\357"+
+ "\4\u0282\2\357\1\u0282\1\357\1\u0282\12\357\4\230\1\u0310"+
+ "\1\230\1\u0311\2\230\3\0\13\230\1\0\2\230\1\76"+
+ "\55\230\3\u0334\1\234\2\230\1\u0334\1\230\3\0\13\230"+
+ "\1\0\2\230\1\76\13\230\2\u0334\3\230\1\u0334\1\230"+
+ "\1\u0334\1\230\1\u0334\2\230\1\u0334\1\230\4\u0334\2\230"+
+ "\1\u0334\1\230\1\u0334\12\230\1\76\3\u028b\3\76\1\u028b"+
+ "\21\76\1\227\1\230\1\231\1\0\1\76\1\0\7\76"+
+ "\2\u028b\3\76\1\u028b\1\76\1\u028b\1\76\1\u028b\2\76"+
+ "\1\u028b\1\76\4\u028b\2\76\1\u028b\1\76\1\u028b\12\76"+
+ "\10\0\1\u032e\3\0\2\u032f\10\0\1\u032e\62\0\1\u031e"+
+ "\2\0\2\u031e\1\0\1\u032f\13\0\1\u031e\1\0\1\u032f"+
+ "\10\0\25\u031e\4\0\1\u031e\1\0\3\u031e\6\0\1\u031e"+
+ "\4\0\3\u0330\1\0\4\u0330\3\0\2\u0330\2\0\1\u0330"+
+ "\1\u0335\6\u0330\7\0\32\u0330\1\0\3\u0330\6\0\1\u0330"+
+ "\4\0\1\u0330\1\u0336\1\u0330\1\0\2\u0336\1\u0330\1\u0331"+
+ "\3\0\2\u0330\2\0\1\u0330\1\u0335\2\u0330\1\u0336\1\u0330"+
+ "\1\u0331\1\u0330\7\0\25\u0336\4\u0330\1\u0336\1\0\3\u0336"+
+ "\6\0\1\u0336\22\0\1\u0337\67\0\1\u012e\3\u0284\1\u016c"+
+ "\2\u012e\1\u0284\1\u012e\2\357\1\76\13\u012e\1\357\2\u012e"+
+ "\1\357\13\u012e\2\u0284\3\u012e\1\u0284\1\u012e\1\u0284\1\u012e"+
+ "\1\u0284\2\u012e\1\u0284\1\u012e\4\u0284\2\u012e\1\u0284\1\u012e"+
+ "\1\u0284\12\u012e\1\230\3\u028d\1\234\2\230\1\u028d\1\230"+
+ "\3\0\13\230\1\0\2\230\1\76\13\230\2\u028d\3\230"+
+ "\1\u028d\1\230\1\u028d\1\230\1\u028d\2\230\1\u028d\1\230"+
+ "\4\u028d\2\230\1\u028d\1\230\1\u028d\12\230\1\0\1\u0330"+
+ "\1\u0336\1\u0330\1\0\2\u0336\1\u0330\1\u0338\3\0\2\u0330"+
+ "\1\u02ae\1\0\1\u0330\1\u0335\2\u0330\1\u0336\1\u0330\1\u0338"+
+ "\1\u0330\7\0\25\u0336\4\u0330\1\u0336\1\0\3\u0336\6\0"+
+ "\1\u0336\4\0\3\u0336\1\0\3\u0336\1\u0339\3\0\1\u0331"+
+ "\1\u0330\1\u02ae\1\0\1\u0330\1\u0335\2\u0330\2\u0336\1\u033a"+
+ "\1\u0336\7\0\32\u0336\1\0\3\u0336\6\0\1\u0336\4\0"+
+ "\3\u0330\1\0\3\u0330\1\u0339\3\0\1\u0331\1\u0330\1\u02ae"+
+ "\1\0\1\u0330\1\u0335\4\u0330\1\u0339\1\u0330\7\0\32\u0330"+
+ "\1\0\3\u0330\6\0\1\u0330\3\0";
+
+ private static int [] zzUnpackTrans() {
+ int [] result = new int[48777];
+ int offset = 0;
+ offset = zzUnpackTrans(ZZ_TRANS_PACKED_0, offset, result);
+ return result;
+ }
+
+ private static int zzUnpackTrans(String packed, int offset, int [] result) {
+ int i = 0; /* index in packed string */
+ int j = offset; /* index in unpacked array */
+ int l = packed.length();
+ while (i < l) {
+ int count = packed.charAt(i++);
+ int value = packed.charAt(i++);
+ value--;
+ do result[j++] = value; while (--count > 0);
+ }
+ return j;
+ }
+
+
+ /* error codes */
+ private static final int ZZ_UNKNOWN_ERROR = 0;
+ private static final int ZZ_NO_MATCH = 1;
+ private static final int ZZ_PUSHBACK_2BIG = 2;
+
+ /* error messages for the codes above */
+ private static final String ZZ_ERROR_MSG[] = {
+ "Unkown internal scanner error",
+ "Error: could not match input",
+ "Error: pushback value was too large"
+ };
+
+ /**
+ * ZZ_ATTRIBUTE[aState] contains the attributes of state aState
+ */
+ private static final int [] ZZ_ATTRIBUTE = zzUnpackAttribute();
+
+ private static final String ZZ_ATTRIBUTE_PACKED_0 =
+ "\2\1\15\0\2\1\1\11\4\1\1\11\2\1\1\11"+
+ "\15\1\2\11\4\1\1\11\2\1\2\11\1\1\1\11"+
+ "\2\1\7\11\4\1\2\11\1\1\1\11\3\1\1\11"+
+ "\1\1\1\11\3\1\2\11\1\1\1\11\3\1\1\11"+
+ "\1\1\1\11\1\1\1\11\1\1\1\11\2\1\3\0"+
+ "\2\11\1\0\1\11\1\0\2\1\1\0\15\1\3\0"+
+ "\1\11\3\1\2\0\1\11\1\1\1\11\4\1\5\11"+
+ "\1\0\1\1\2\0\1\11\1\1\3\0\1\11\1\1"+
+ "\10\0\1\11\4\1\6\11\3\0\1\11\5\0\1\1"+
+ "\1\0\1\1\1\11\1\1\1\11\2\1\1\11\35\1"+
+ "\3\0\6\1\1\0\1\11\1\0\1\1\6\0\2\11"+
+ "\1\0\1\1\4\0\1\11\1\0\1\1\1\11\1\1"+
+ "\1\11\3\0\42\1\3\0\2\1\1\0\1\11\1\1"+
+ "\14\0\1\11\1\1\3\0\46\1\2\11\1\0\2\1"+
+ "\1\0\1\1\13\0\1\1\5\0\11\1\1\0\31\1"+
+ "\1\11\2\1\7\0\2\1\10\0\1\1\1\11\3\0"+
+ "\12\1\1\0\17\1\1\0\7\1\6\0\2\1\3\0"+
+ "\1\1\6\0\1\1\1\11\4\0\13\1\4\0\22\1"+
+ "\1\11\6\0\1\1\6\0\1\1\13\0\10\1\3\0"+
+ "\15\1\1\0\2\1\1\0\5\1\4\0\2\11\2\1"+
+ "\4\0\2\1\7\0\1\1\1\11\1\0\12\1\1\0"+
+ "\1\1\1\0\7\1\2\0\1\1\1\0\2\1\2\0"+
+ "\1\11\2\0\1\1\2\0\2\1\4\0\1\1\2\0"+
+ "\2\1\7\0\4\1\1\0\1\1\1\0\1\1\1\0"+
+ "\3\1\2\0\11\1\1\0\1\1\3\0\1\1\1\0"+
+ "\2\1\3\0\1\11\1\0\4\1\3\0\4\1\3\0"+
+ "\1\1\1\11\1\0\4\1\3\0\2\1\2\0\10\1"+
+ "\12\0\3\1\5\0\3\1\1\0\1\1\1\11\1\0"+
+ "\6\1\3\0\10\1\2\0\2\11\4\0\1\1\3\0"+
+ "\2\1\1\11\1\1\1\0\1\1\1\11\1\0\5\1"+
+ "\1\0\2\1\1\0\1\1\3\0\1\1\2\0\1\1"+
+ "\1\11\2\1\10\0\1\11\3\1";
+
+ private static int [] zzUnpackAttribute() {
+ int [] result = new int[826];
+ int offset = 0;
+ offset = zzUnpackAttribute(ZZ_ATTRIBUTE_PACKED_0, offset, result);
+ return result;
+ }
+
+ private static int zzUnpackAttribute(String packed, int offset, int [] result) {
+ int i = 0; /* index in packed string */
+ int j = offset; /* index in unpacked array */
+ int l = packed.length();
+ while (i < l) {
+ int count = packed.charAt(i++);
+ int value = packed.charAt(i++);
+ do result[j++] = value; while (--count > 0);
+ }
+ return j;
+ }
+
+ /** the input device */
+ private java.io.Reader zzReader;
+
+ /** the current state of the DFA */
+ private int zzState;
+
+ /** the current lexical state */
+ private int zzLexicalState = YYINITIAL;
+
+ /** this buffer contains the current text to be matched and is
+ the source of the yytext() string */
+ private char zzBuffer[] = new char[ZZ_BUFFERSIZE];
+
+ /** the textposition at the last accepting state */
+ private int zzMarkedPos;
+
+ /** the current text position in the buffer */
+ private int zzCurrentPos;
+
+ /** startRead marks the beginning of the yytext() string in the buffer */
+ private int zzStartRead;
+
+ /** endRead marks the last character in the buffer, that has been read
+ from input */
+ private int zzEndRead;
+
+ /** number of newlines encountered up to the start of the matched text */
+ private int yyline;
+
+ /** the number of characters up to the start of the matched text */
+ private int yychar;
+
+ /**
+ * the number of characters from the last newline up to the start of the
+ * matched text
+ */
+ private int yycolumn;
+
+ /**
+ * zzAtBOL == true <=> the scanner is currently at the beginning of a line
+ */
+ private boolean zzAtBOL = true;
+
+ /** zzAtEOF == true <=> the scanner is at the EOF */
+ private boolean zzAtEOF;
+
+ /** denotes if the user-EOF-code has already been executed */
+ private boolean zzEOFDone;
+
+ /** the stack of open (nested) input streams to read from */
+ private java.util.Stack zzStreams = new java.util.Stack();
+
+ /**
+ * inner class used to store info for nested
+ * input streams
+ */
+ private static final class ZzFlexStreamInfo {
+ java.io.Reader zzReader;
+ int zzEndRead;
+ int zzStartRead;
+ int zzCurrentPos;
+ int zzMarkedPos;
+ int yyline;
+ int yycolumn;
+ char [] zzBuffer;
+ boolean zzAtEOF;
+ boolean zzEOFDone;
+
+ /** sets all values stored in this class */
+ ZzFlexStreamInfo(java.io.Reader zzReader, int zzEndRead, int zzStartRead,
+ int zzCurrentPos, int zzMarkedPos,
+ char [] zzBuffer, boolean zzAtEOF, int yyline, int yycolumn) {
+ this.zzReader = zzReader;
+ this.zzEndRead = zzEndRead;
+ this.zzStartRead = zzStartRead;
+ this.zzCurrentPos = zzCurrentPos;
+ this.zzMarkedPos = zzMarkedPos;
+ this.zzBuffer = zzBuffer;
+ this.zzAtEOF = zzAtEOF;
+ this.zzEOFDone = zzEOFDone;
+ this.yyline = yyline;
+ this.yycolumn = yycolumn;
+ }
+ }
+
+ /* user code: */
+ int balance = 0;
+ int commentbalance = 0;
+ int action_line = 0;
+ int bufferSize = 16384;
+
+ File file;
+ Stack files = new Stack();
+
+ StringBuffer userCode = new StringBuffer();
+
+ String classCode;
+ String initCode;
+ String initThrow;
+ String eofCode;
+ String eofThrow;
+ String lexThrow;
+ String eofVal;
+ String scanErrorException;
+ String cupSymbol = "sym";
+
+ StringBuffer actionText = new StringBuffer();
+ StringBuffer string = new StringBuffer();
+
+ boolean charCount;
+ boolean lineCount;
+ boolean columnCount;
+ boolean cupCompatible;
+ boolean cupDebug;
+ boolean isInteger;
+ boolean isIntWrap;
+ boolean isYYEOF;
+ boolean notUnix;
+ boolean isPublic;
+ boolean isFinal;
+ boolean isAbstract;
+ boolean bolUsed;
+ boolean standalone;
+ boolean debugOption;
+ boolean useRowMap = Options.gen_method == Options.PACK || Options.gen_method == Options.TABLE;
+ boolean packed = Options.gen_method == Options.PACK;
+ boolean caseless;
+ boolean inclusive_states;
+ boolean eofclose;
+
+ String isImplementing;
+ String isExtending;
+ String className = "Yylex";
+ String functionName;
+ String tokenType;
+ String visibility = "public";
+
+ Vector /* String */ ctorArgs = new Vector();
+ Vector /* String */ ctorTypes = new Vector();
+
+ LexicalStates states = new LexicalStates();
+
+ Vector actions = new Vector();
+
+ private int nextState;
+
+ boolean macroDefinition;
+
+ Timer t = new Timer();
+
+ public int currentLine() {
+ return yyline;
+ }
+
+ public void setFile(File file) {
+ this.file = file;
+ }
+
+ private Symbol symbol(int type, Object value) {
+ return new Symbol(type, yyline, yycolumn, value);
+ }
+
+ private Symbol symbol(int type) {
+ return new Symbol(type, yyline, yycolumn);
+ }
+
+ // updates line and column count to the beginning of the first
+ // non whitespace character in yytext, but leaves yyline+yycolumn
+ // untouched
+ private Symbol symbol_countUpdate(int type, Object value) {
+ int lc = yyline;
+ int cc = yycolumn;
+ String text = yytext();
+
+ for (int i=0; i < text.length(); i++) {
+ char c = text.charAt(i);
+
+ if (c != '\n' && c != '\r' && c != ' ' && c != '\t' )
+ return new Symbol(type, lc, cc, value);
+
+ if (c == '\n') {
+ lc++;
+ cc = 0;
+ }
+ else
+ cc++;
+ }
+
+ return new Symbol(type, yyline, yycolumn, value);
+ }
+
+ private String makeMacroIdent() {
+ String matched = yytext().trim();
+ return matched.substring(1, matched.length()-1).trim();
+ }
+
+ public static String conc(Object a, Object b) {
+ if (a == null && b == null) return null;
+ if (a == null) return b.toString();
+ if (b == null) return a.toString();
+
+ return a.toString()+b.toString();
+ }
+
+ public static String concExc(Object a, Object b) {
+ if (a == null && b == null) return null;
+ if (a == null) return b.toString();
+ if (b == null) return a.toString();
+
+ return a.toString()+", "+b.toString();
+ }
+
+
+ /**
+ * Creates a new scanner
+ * There is also a java.io.InputStream version of this constructor.
+ *
+ * @param in the java.io.Reader to read input from.
+ */
+ public LexScan(java.io.Reader in) {
+ states.insert("YYINITIAL", true);
+ this.zzReader = in;
+ }
+
+ /**
+ * Creates a new scanner.
+ * There is also java.io.Reader version of this constructor.
+ *
+ * @param in the java.io.Inputstream to read input from.
+ */
+ public LexScan(java.io.InputStream in) {
+ this(new java.io.InputStreamReader(in));
+ }
+
+ /**
+ * Unpacks the compressed character translation table.
+ *
+ * @param packed the packed character translation table
+ * @return the unpacked character translation table
+ */
+ private static char [] zzUnpackCMap(String packed) {
+ char [] map = new char[0x10000];
+ int i = 0; /* index in packed string */
+ int j = 0; /* index in unpacked array */
+ while (i < 1788) {
+ int count = packed.charAt(i++);
+ char value = packed.charAt(i++);
+ do map[j++] = value; while (--count > 0);
+ }
+ return map;
+ }
+
+
+ /**
+ * Refills the input buffer.
+ *
+ * @return false
, iff there was new input.
+ *
+ * @exception java.io.IOException if any I/O-Error occurs
+ */
+ private boolean zzRefill() throws java.io.IOException {
+
+ /* first: make room (if you can) */
+ if (zzStartRead > 0) {
+ System.arraycopy(zzBuffer, zzStartRead,
+ zzBuffer, 0,
+ zzEndRead-zzStartRead);
+
+ /* translate stored positions */
+ zzEndRead-= zzStartRead;
+ zzCurrentPos-= zzStartRead;
+ zzMarkedPos-= zzStartRead;
+ zzStartRead = 0;
+ }
+
+ /* is the buffer big enough? */
+ if (zzCurrentPos >= zzBuffer.length) {
+ /* if not: blow it up */
+ char newBuffer[] = new char[zzCurrentPos*2];
+ System.arraycopy(zzBuffer, 0, newBuffer, 0, zzBuffer.length);
+ zzBuffer = newBuffer;
+ }
+
+ /* finally: fill the buffer with new input */
+ int numRead = zzReader.read(zzBuffer, zzEndRead,
+ zzBuffer.length-zzEndRead);
+
+ if (numRead > 0) {
+ zzEndRead+= numRead;
+ return false;
+ }
+ // unlikely but not impossible: read 0 characters, but not at end of stream
+ if (numRead == 0) {
+ int c = zzReader.read();
+ if (c == -1) {
+ return true;
+ } else {
+ zzBuffer[zzEndRead++] = (char) c;
+ return false;
+ }
+ }
+
+ // numRead < 0)
+ return true;
+ }
+
+
+ /**
+ * Closes the input stream.
+ */
+ public final void yyclose() throws java.io.IOException {
+ zzAtEOF = true; /* indicate end of file */
+ zzEndRead = zzStartRead; /* invalidate buffer */
+
+ if (zzReader != null)
+ zzReader.close();
+ }
+
+
+ /**
+ * Stores the current input stream on a stack, and
+ * reads from a new stream. Lexical state, line,
+ * char, and column counting remain untouched.
+ *
+ * The current input stream can be restored with
+ * yypopstream (usually in an <> action).
+ *
+ * @param reader the new input stream to read from
+ *
+ * @see #yypopStream()
+ */
+ public final void yypushStream(java.io.Reader reader) {
+ zzStreams.push(
+ new ZzFlexStreamInfo(zzReader, zzEndRead, zzStartRead, zzCurrentPos,
+ zzMarkedPos, zzBuffer, zzAtEOF,
+ yyline, yycolumn)
+ );
+ zzAtEOF = false;
+ zzBuffer = new char[ZZ_BUFFERSIZE];
+ zzReader = reader;
+ zzEndRead = zzStartRead = 0;
+ zzCurrentPos = zzMarkedPos = 0;
+ yyline = yycolumn = 0;
+ }
+
+
+ /**
+ * Closes the current input stream and continues to
+ * read from the one on top of the stream stack.
+ *
+ * @throws java.util.EmptyStackException
+ * if there is no further stream to read from.
+ *
+ * @throws java.io.IOException
+ * if there was an error in closing the stream.
+ *
+ * @see #yypushStream(java.io.Reader)
+ */
+ public final void yypopStream() throws java.io.IOException {
+ zzReader.close();
+ ZzFlexStreamInfo s = (ZzFlexStreamInfo) zzStreams.pop();
+ zzBuffer = s.zzBuffer;
+ zzReader = s.zzReader;
+ zzEndRead = s.zzEndRead;
+ zzStartRead = s.zzStartRead;
+ zzCurrentPos = s.zzCurrentPos;
+ zzMarkedPos = s.zzMarkedPos ;
+ zzAtEOF = s.zzAtEOF;
+ zzEOFDone = s.zzEOFDone;
+ yyline = s.yyline;
+ yycolumn = s.yycolumn;
+ }
+
+
+ /**
+ * Returns true iff there are still streams left
+ * to read from on the stream stack.
+ */
+ public final boolean yymoreStreams() {
+ return !zzStreams.isEmpty();
+ }
+
+
+ /**
+ * Resets the scanner to read from a new input stream.
+ * Does not close the old reader.
+ *
+ * All internal variables are reset, the old input stream
+ * cannot be reused (internal buffer is discarded and lost).
+ * Lexical state is set to ZZ_INITIAL.
+ *
+ * @param reader the new input stream
+ *
+ * @see #yypushStream(java.io.Reader)
+ * @see #yypopStream()
+ */
+ public final void yyreset(java.io.Reader reader) {
+ zzReader = reader;
+ zzAtBOL = true;
+ zzAtEOF = false;
+ zzEOFDone = false;
+ zzEndRead = zzStartRead = 0;
+ zzCurrentPos = zzMarkedPos = 0;
+ yyline = yychar = yycolumn = 0;
+ zzLexicalState = YYINITIAL;
+ }
+
+
+ /**
+ * Returns the current lexical state.
+ */
+ public final int yystate() {
+ return zzLexicalState;
+ }
+
+
+ /**
+ * Enters a new lexical state
+ *
+ * @param newState the new lexical state
+ */
+ public final void yybegin(int newState) {
+ zzLexicalState = newState;
+ }
+
+
+ /**
+ * Returns the text matched by the current regular expression.
+ */
+ public final String yytext() {
+ return new String( zzBuffer, zzStartRead, zzMarkedPos-zzStartRead );
+ }
+
+
+ /**
+ * Returns the character at position pos from the
+ * matched text.
+ *
+ * It is equivalent to yytext().charAt(pos), but faster
+ *
+ * @param pos the position of the character to fetch.
+ * A value from 0 to yylength()-1.
+ *
+ * @return the character at position pos
+ */
+ public final char yycharat(int pos) {
+ return zzBuffer[zzStartRead+pos];
+ }
+
+
+ /**
+ * Returns the length of the matched text region.
+ */
+ public final int yylength() {
+ return zzMarkedPos-zzStartRead;
+ }
+
+
+ /**
+ * Reports an error that occured while scanning.
+ *
+ * In a wellformed scanner (no or only correct usage of
+ * yypushback(int) and a match-all fallback rule) this method
+ * will only be called with things that "Can't Possibly Happen".
+ * If this method is called, something is seriously wrong
+ * (e.g. a JFlex bug producing a faulty scanner etc.).
+ *
+ * Usual syntax/scanner level error handling should be done
+ * in error fallback rules.
+ *
+ * @param errorCode the code of the errormessage to display
+ */
+ private void zzScanError(int errorCode) {
+ String message;
+ try {
+ message = ZZ_ERROR_MSG[errorCode];
+ }
+ catch (ArrayIndexOutOfBoundsException e) {
+ message = ZZ_ERROR_MSG[ZZ_UNKNOWN_ERROR];
+ }
+
+ throw new Error(message);
+ }
+
+
+ /**
+ * Pushes the specified amount of characters back into the input stream.
+ *
+ * They will be read again by then next call of the scanning method
+ *
+ * @param number the number of characters to be read again.
+ * This number must not be greater than yylength()!
+ */
+ public void yypushback(int number) {
+ if ( number > yylength() )
+ zzScanError(ZZ_PUSHBACK_2BIG);
+
+ zzMarkedPos -= number;
+ }
+
+
+ /**
+ * Contains user EOF-code, which will be executed exactly once,
+ * when the end of file is reached
+ */
+ private void zzDoEOF() throws java.io.IOException {
+ if (!zzEOFDone) {
+ zzEOFDone = true;
+ yyclose();
+ }
+ }
+
+
+ /**
+ * Resumes scanning until the next regular expression is matched,
+ * the end of input is encountered or an I/O-Error occurs.
+ *
+ * @return the next token
+ * @exception java.io.IOException if any I/O-Error occurs
+ */
+ public Symbol next_token() throws java.io.IOException {
+ int zzInput;
+ int zzAction;
+
+ int [] zzTransL = ZZ_TRANS;
+ int [] zzRowMapL = ZZ_ROWMAP;
+ int [] zzAttrL = ZZ_ATTRIBUTE;
+
+ while (true) {
+ // cached fields:
+ int zzCurrentPosL;
+ int zzMarkedPosL = zzMarkedPos;
+ int zzEndReadL = zzEndRead;
+ char [] zzBufferL = zzBuffer;
+ char [] zzCMapL = ZZ_CMAP;
+
+ boolean zzR = false;
+ for (zzCurrentPosL = zzStartRead; zzCurrentPosL < zzMarkedPosL;
+ zzCurrentPosL++) {
+ switch (zzBufferL[zzCurrentPosL]) {
+ case '\u000B':
+ case '\u000C':
+ case '\u0085':
+ case '\u2028':
+ case '\u2029':
+ yyline++;
+ yycolumn = 0;
+ zzR = false;
+ break;
+ case '\r':
+ yyline++;
+ yycolumn = 0;
+ zzR = true;
+ break;
+ case '\n':
+ if (zzR)
+ zzR = false;
+ else {
+ yyline++;
+ yycolumn = 0;
+ }
+ break;
+ default:
+ zzR = false;
+ yycolumn++;
+ }
+ }
+
+ if (zzR) {
+ // peek one character ahead if it is \n (if we have counted one line too much)
+ boolean zzPeek;
+ if (zzMarkedPosL < zzEndReadL)
+ zzPeek = zzBufferL[zzMarkedPosL] == '\n';
+ else if (zzAtEOF)
+ zzPeek = false;
+ else {
+ boolean eof = zzRefill();
+ zzEndReadL = zzEndRead;
+ zzMarkedPosL = zzMarkedPos;
+ zzBufferL = zzBuffer;
+ if (eof)
+ zzPeek = false;
+ else
+ zzPeek = zzBufferL[zzMarkedPosL] == '\n';
+ }
+ if (zzPeek) yyline--;
+ }
+ if (zzMarkedPosL > zzStartRead) {
+ switch (zzBufferL[zzMarkedPosL-1]) {
+ case '\n':
+ case '\u000B':
+ case '\u000C':
+ case '\u0085':
+ case '\u2028':
+ case '\u2029':
+ zzAtBOL = true;
+ break;
+ case '\r':
+ if (zzMarkedPosL < zzEndReadL)
+ zzAtBOL = zzBufferL[zzMarkedPosL] != '\n';
+ else if (zzAtEOF)
+ zzAtBOL = false;
+ else {
+ boolean eof = zzRefill();
+ zzMarkedPosL = zzMarkedPos;
+ zzEndReadL = zzEndRead;
+ zzBufferL = zzBuffer;
+ if (eof)
+ zzAtBOL = false;
+ else
+ zzAtBOL = zzBufferL[zzMarkedPosL] != '\n';
+ }
+ break;
+ default:
+ zzAtBOL = false;
+ }
+ }
+ zzAction = -1;
+
+ zzCurrentPosL = zzCurrentPos = zzStartRead = zzMarkedPosL;
+
+ if (zzAtBOL)
+ zzState = ZZ_LEXSTATE[zzLexicalState+1];
+ else
+ zzState = ZZ_LEXSTATE[zzLexicalState];
+
+
+ zzForAction: {
+ while (true) {
+
+ if (zzCurrentPosL < zzEndReadL)
+ zzInput = zzBufferL[zzCurrentPosL++];
+ else if (zzAtEOF) {
+ zzInput = YYEOF;
+ break zzForAction;
+ }
+ else {
+ // store back cached positions
+ zzCurrentPos = zzCurrentPosL;
+ zzMarkedPos = zzMarkedPosL;
+ boolean eof = zzRefill();
+ // get translated positions and possibly new buffer
+ zzCurrentPosL = zzCurrentPos;
+ zzMarkedPosL = zzMarkedPos;
+ zzBufferL = zzBuffer;
+ zzEndReadL = zzEndRead;
+ if (eof) {
+ zzInput = YYEOF;
+ break zzForAction;
+ }
+ else {
+ zzInput = zzBufferL[zzCurrentPosL++];
+ }
+ }
+ int zzNext = zzTransL[ zzRowMapL[zzState] + zzCMapL[zzInput] ];
+ if (zzNext == -1) break zzForAction;
+ zzState = zzNext;
+
+ int zzAttributes = zzAttrL[zzState];
+ if ( (zzAttributes & 1) == 1 ) {
+ zzAction = zzState;
+ zzMarkedPosL = zzCurrentPosL;
+ if ( (zzAttributes & 8) == 8 ) break zzForAction;
+ }
+
+ }
+ }
+
+ // store back cached position
+ zzMarkedPos = zzMarkedPosL;
+
+ switch (zzAction < 0 ? zzAction : ZZ_ACTION[zzAction]) {
+ case 118:
+ { cupDebug = true;
+ }
+ case 147: break;
+ case 122:
+ { actionText.setLength(0); yybegin(JAVA_CODE); action_line = yyline+1; return symbol(EOFRULE);
+ }
+ case 148: break;
+ case 113:
+ { File f = new File(yytext().substring(9).trim());
+ if ( !f.canRead() )
+ throw new ScannerException(file,ErrorMessages.NOT_READABLE, yyline);
+ // check for cycle
+ if (files.search(f) > 0)
+ throw new ScannerException(file,ErrorMessages.FILE_CYCLE, yyline);
+ try {
+ yypushStream( new FileReader(f) );
+ files.push(file);
+ file = f;
+ Out.println("Including \""+file+"\"");
+ }
+ catch (FileNotFoundException e) {
+ throw new ScannerException(file,ErrorMessages.NOT_READABLE, yyline);
+ }
+ }
+ case 149: break;
+ case 88:
+ { return symbol(FULL);
+ }
+ case 150: break;
+ case 92:
+ { return symbol(ASCII);
+ }
+ case 151: break;
+ case 21:
+ { string.setLength(0); nextState = REGEXP; yybegin(STRING_CONTENT);
+ }
+ case 152: break;
+ case 142:
+ { return symbol(UPPERCLASS);
+ }
+ case 153: break;
+ case 34:
+ { return symbol(COMMA);
+ }
+ case 154: break;
+ case 61:
+ { return symbol(CHAR,new Character('\f'));
+ }
+ case 155: break;
+ case 111:
+ { throw new ScannerException(file,ErrorMessages.NO_BUFFER_SIZE, yyline);
+ }
+ case 156: break;
+ case 104:
+ { throw new ScannerException(file,ErrorMessages.EOF_WO_ACTION);
+ }
+ case 157: break;
+ case 143:
+ { return symbol(LOWERCLASS);
+ }
+ case 158: break;
+ case 72:
+ { string.append('\r');
+ }
+ case 159: break;
+ case 43:
+ { return symbol(HAT);
+ }
+ case 160: break;
+ case 48:
+ { yybegin(MACROS); ctorArgs.add(yytext().trim());
+ }
+ case 161: break;
+ case 1:
+ { return symbol(EOF);
+ }
+ case 162: break;
+ case 59:
+ { return symbol(CHAR,new Character('\t'));
+ }
+ case 163: break;
+ case 145:
+ { eofclose = false;
+ }
+ case 164: break;
+ case 103:
+ { isPublic = true;
+ }
+ case 165: break;
+ case 112:
+ { actionText.setLength(0); yybegin(JAVA_CODE);
+ Symbol s = symbol_countUpdate(EOFRULE, null);
+ action_line = s.left+1;
+ return s;
+ }
+ case 166: break;
+ case 40:
+ { balance++; return symbol(OPENCLASS);
+ }
+ case 167: break;
+ case 11:
+ { yybegin(REGEXP);
+ }
+ case 168: break;
+ case 12:
+ { yybegin(STATES); return symbol_countUpdate(LESSTHAN, null);
+ }
+ case 169: break;
+ case 68:
+ { string.append( (char) Integer.parseInt(yytext().substring(1,yytext().length()), 8));
+ }
+ case 170: break;
+ case 62:
+ { return symbol(CHAR,new Character('\b'));
+ }
+ case 171: break;
+ case 39:
+ { throw new ScannerException(file,ErrorMessages.EOL_IN_CHARCLASS,yyline,yycolumn);
+ }
+ case 172: break;
+ case 5:
+ { states.insert(yytext(),inclusive_states);
+ }
+ case 173: break;
+ case 70:
+ { string.append('\n');
+ }
+ case 174: break;
+ case 10:
+ { yybegin(REGEXP); return symbol(EQUALS);
+ }
+ case 175: break;
+ case 146:
+ { return symbol(JLETTERDIGITCLASS);
+ }
+ case 176: break;
+ case 19:
+ { return symbol(STAR);
+ }
+ case 177: break;
+ case 42:
+ { string.setLength(0); nextState = CHARCLASS; yybegin(STRING_CONTENT);
+ }
+ case 178: break;
+ case 116:
+ { isAbstract = true;
+ }
+ case 179: break;
+ case 75:
+ { yypushback(1); yycolumn--; return symbol(CHAR, new Character(yytext().charAt(0)));
+ }
+ case 180: break;
+ case 114:
+ { lexThrow = concExc(lexThrow,yytext().substring(8).trim());
+ }
+ case 181: break;
+ case 109:
+ { throw new ScannerException(file,ErrorMessages.QUIL_CUPSYM, yyline);
+ }
+ case 182: break;
+ case 93:
+ { packed = false; useRowMap = true;
+ }
+ case 183: break;
+ case 87:
+ { cupCompatible = true;
+ isImplementing = concExc(isImplementing, "java_cup.runtime.Scanner");
+ if (functionName == null)
+ functionName = "next_token";
+ if (tokenType == null)
+ tokenType = "java_cup.runtime.Symbol";
+ if (eofVal == null)
+ eofVal = "return new java_cup.runtime.Symbol("+cupSymbol+".EOF);";
+ if (!Options.jlex) eofclose = true;
+ }
+ case 184: break;
+ case 30:
+ { bolUsed = true; return symbol(HAT);
+ }
+ case 185: break;
+ case 4:
+ { throw new ScannerException(file,ErrorMessages.UNEXPECTED_CHAR, yyline, yycolumn);
+ }
+ case 186: break;
+ case 35:
+ { yybegin(REGEXP); return symbol(MORETHAN);
+ }
+ case 187: break;
+ case 100:
+ { packed = false; useRowMap = false;
+ }
+ case 188: break;
+ case 119:
+ { caseless = true;
+ }
+ case 189: break;
+ case 38:
+ { yybegin(nextState); return symbol(STRING, string.toString());
+ }
+ case 190: break;
+ case 76:
+ { return symbol(REPEAT, new Integer(yytext().substring(1).trim()));
+ }
+ case 191: break;
+ case 13:
+ { return symbol_countUpdate(RBRACE, null);
+ }
+ case 192: break;
+ case 139:
+ { scanErrorException = yytext().substring(11).trim();
+ }
+ case 193: break;
+ case 141:
+ { lexThrow = concExc(lexThrow,yytext().substring(12).trim());
+ }
+ case 194: break;
+ case 84:
+ { return symbol(MACROUSE, yytext().substring(1,yytext().length()-1));
+ }
+ case 195: break;
+ case 2:
+ { /* ignore */
+ }
+ case 196: break;
+ case 127:
+ { throw new ScannerException(file,ErrorMessages.QUIL_INITTHROW, yyline);
+ }
+ case 197: break;
+ case 47:
+ { throw new ScannerException(file,ErrorMessages.CTOR_ARG,yyline,yycolumn);
+ }
+ case 198: break;
+ case 108:
+ { throw new ScannerException(file,ErrorMessages.QUIL_THROW, yyline);
+ }
+ case 199: break;
+ case 31:
+ { actionText.append(yytext());
+ }
+ case 200: break;
+ case 83:
+ { string.append( (char) Integer.parseInt(yytext().substring(2,yytext().length()), 16));
+ }
+ case 201: break;
+ case 107:
+ { notUnix = true;
+ }
+ case 202: break;
+ case 89:
+ { lineCount = true;
+ }
+ case 203: break;
+ case 136:
+ { initThrow = concExc(initThrow,yytext().substring(11).trim());
+ }
+ case 204: break;
+ case 131:
+ { standalone = true; isInteger = true;
+ }
+ case 205: break;
+ case 52:
+ { nextState = MACROS; yybegin(COMMENT);
+ }
+ case 206: break;
+ case 25:
+ { return symbol(TILDE);
+ }
+ case 207: break;
+ case 37:
+ { throw new ScannerException(file,ErrorMessages.UNTERMINATED_STR, yyline, yycolumn);
+ }
+ case 208: break;
+ case 110:
+ { className = yytext().substring(7).trim();
+ }
+ case 209: break;
+ case 9:
+ { throw new ScannerException(file,ErrorMessages.UNKNOWN_OPTION, yyline, yycolumn);
+ }
+ case 210: break;
+ case 55:
+ { nextState = REGEXPSTART; yybegin(COMMENT);
+ }
+ case 211: break;
+ case 16:
+ { return symbol(POINT);
+ }
+ case 212: break;
+ case 73:
+ { string.append('\f');
+ }
+ case 213: break;
+ case 65:
+ { yybegin(REPEATEXP); return symbol(REPEAT, new Integer(yytext().trim().substring(1).trim()));
+ }
+ case 214: break;
+ case 80:
+ { return symbol(CHAR, new Character( (char) Integer.parseInt(yytext().substring(2,yytext().length()), 16)));
+ }
+ case 215: break;
+ case 140:
+ { initThrow = concExc(initThrow,string); yybegin(MACROS);
+ }
+ case 216: break;
+ case 135:
+ { eofThrow = concExc(eofThrow,string); yybegin(MACROS);
+ }
+ case 217: break;
+ case 71:
+ { string.append('\t');
+ }
+ case 218: break;
+ case 67:
+ { string.append(yytext().charAt(1));
+ }
+ case 219: break;
+ case 7:
+ { yybegin(MACROS);
+ }
+ case 220: break;
+ case 98:
+ { eofCode = conc(eofCode,string); yybegin(MACROS);
+ }
+ case 221: break;
+ case 56:
+ { return symbol(CHAR, new Character(yytext().charAt(1)));
+ }
+ case 222: break;
+ case 28:
+ { return symbol(PLUS);
+ }
+ case 223: break;
+ case 101:
+ { columnCount = true;
+ }
+ case 224: break;
+ case 124:
+ { isExtending = yytext().substring(9).trim();
+ }
+ case 225: break;
+ case 123:
+ { eofVal = string.toString(); yybegin(MACROS);
+ }
+ case 226: break;
+ case 36:
+ { string.append(yytext());
+ }
+ case 227: break;
+ case 97:
+ { return symbol(UNICODE);
+ }
+ case 228: break;
+ case 74:
+ { string.append('\b');
+ }
+ case 229: break;
+ case 24:
+ { return symbol(BANG);
+ }
+ case 230: break;
+ case 132:
+ { throw new ScannerException(file,ErrorMessages.QUIL_SCANERROR, yyline);
+ }
+ case 231: break;
+ case 91:
+ { packed = true; useRowMap = true;
+ }
+ case 232: break;
+ case 26:
+ { return symbol(OPENBRACKET);
+ }
+ case 233: break;
+ case 60:
+ { return symbol(CHAR,new Character('\r'));
+ }
+ case 234: break;
+ case 94:
+ { isFinal = true;
+ }
+ case 235: break;
+ case 27:
+ { return symbol(CLOSEBRACKET);
+ }
+ case 236: break;
+ case 86:
+ { isInteger = true;
+ }
+ case 237: break;
+ case 20:
+ { return symbol(LOOKAHEAD);
+ }
+ case 238: break;
+ case 51:
+ { commentbalance++;
+ }
+ case 239: break;
+ case 49:
+ { t.start();
+ yybegin(MACROS);
+ macroDefinition = true;
+ return symbol(USERCODE,userCode);
+ }
+ case 240: break;
+ case 44:
+ { return symbol(DASH);
+ }
+ case 241: break;
+ case 138:
+ { throw new ScannerException(file,ErrorMessages.QUIL_YYLEXTHROW, yyline);
+ }
+ case 242: break;
+ case 96:
+ { debugOption = true;
+ }
+ case 243: break;
+ case 64:
+ { nextState = REGEXP; yybegin(COMMENT);
+ }
+ case 244: break;
+ case 32:
+ { if (balance > 0) {
+ balance--;
+ actionText.append('}');
+ }
+ else {
+ yybegin(REGEXPSTART);
+ Action a = new Action(actionText.toString(), action_line);
+ actions.addElement(a);
+ return symbol(ACTION, a);
+ }
+ }
+ case 245: break;
+ case 29:
+ { return symbol(DOLLAR);
+ }
+ case 246: break;
+ case 17:
+ { yybegin(CHARCLASS); return symbol(OPENCLASS);
+ }
+ case 247: break;
+ case 105:
+ { initCode = conc(initCode,string); yybegin(MACROS);
+ }
+ case 248: break;
+ case 69:
+ { string.append('\"');
+ }
+ case 249: break;
+ case 137:
+ { isImplementing = concExc(isImplementing, yytext().substring(12).trim());
+ }
+ case 250: break;
+ case 126:
+ { return symbol(LETTERCLASS);
+ }
+ case 251: break;
+ case 102:
+ { isInteger = true;
+ if (eofVal == null)
+ eofVal = "return 0;";
+ eofclose = true;
+ }
+ case 252: break;
+ case 41:
+ { if (balance > 0) balance--; else yybegin(REGEXP); return symbol(CLOSECLASS);
+ }
+ case 253: break;
+ case 77:
+ { string.setLength(0); yybegin(COPY);
+ }
+ case 254: break;
+ case 8:
+ { return symbol(IDENT, yytext());
+ }
+ case 255: break;
+ case 121:
+ { return symbol(DIGITCLASS);
+ }
+ case 256: break;
+ case 144:
+ { lexThrow = concExc(lexThrow,string); yybegin(MACROS);
+ }
+ case 257: break;
+ case 53:
+ { Out.warning(ErrorMessages.NOT_AT_BOL, yyline); yypushback(1);
+ }
+ case 258: break;
+ case 23:
+ { return symbol(BAR);
+ }
+ case 259: break;
+ case 45:
+ { throw new ScannerException(file,ErrorMessages.UNEXPECTED_NL, yyline, yycolumn);
+ }
+ case 260: break;
+ case 117:
+ { cupSymbol = yytext().substring(8).trim();
+ if (cupCompatible) Out.warning(ErrorMessages.CUPSYM_AFTER_CUP, yyline);
+ }
+ case 261: break;
+ case 58:
+ { return symbol(CHAR,new Character('\n'));
+ }
+ case 262: break;
+ case 95:
+ { isYYEOF = true;
+ }
+ case 263: break;
+ case 14:
+ { return symbol(CHAR, new Character(yytext().charAt(0)));
+ }
+ case 264: break;
+ case 99:
+ { tokenType = yytext().substring(6).trim();
+ }
+ case 265: break;
+ case 33:
+ { balance++; actionText.append('{');
+ }
+ case 266: break;
+ case 128:
+ { eofThrow = concExc(eofThrow,yytext().substring(10).trim());
+ }
+ case 267: break;
+ case 63:
+ { actionText.setLength(0); yybegin(JAVA_CODE); action_line = yyline+1; return symbol(REGEXPEND);
+ }
+ case 268: break;
+ case 81:
+ { return symbol_countUpdate(MACROUSE, makeMacroIdent());
+ }
+ case 269: break;
+ case 15:
+ { if (macroDefinition) { yybegin(MACROS); } return symbol(REGEXPEND);
+ }
+ case 270: break;
+ case 125:
+ { throw new ScannerException(file,ErrorMessages.QUIL_EOFTHROW, yyline);
+ }
+ case 271: break;
+ case 90:
+ { charCount = true;
+ }
+ case 272: break;
+ case 130:
+ { visibility = "private"; Skeleton.makePrivate();
+ }
+ case 273: break;
+ case 134:
+ { return symbol(JLETTERCLASS);
+ }
+ case 274: break;
+ case 22:
+ { yybegin(REGEXPSTART); return symbol(LBRACE);
+ }
+ case 275: break;
+ case 115:
+ { eofclose = true;
+ }
+ case 276: break;
+ case 66:
+ // lookahead expression with fixed lookahead length
+ yypushback(1);
+ { if (macroDefinition) {
+ yybegin(EATWSPNL);
+ return symbol(BAR);
+ }
+ else {
+ yybegin(REGEXPSTART);
+ return symbol(NOACTION);
+ }
+ }
+ case 277: break;
+ case 82:
+ // lookahead expression with fixed lookahead length
+ yypushback(2);
+ { if (macroDefinition) {
+ yybegin(EATWSPNL);
+ return symbol(BAR);
+ }
+ else {
+ yybegin(REGEXPSTART);
+ return symbol(NOACTION);
+ }
+ }
+ case 278: break;
+ case 46:
+ { yybegin(REGEXP); return symbol(RBRACE);
+ }
+ case 279: break;
+ case 78:
+ { inclusive_states = false; yybegin(STATELIST);
+ }
+ case 280: break;
+ case 120:
+ { bufferSize = Integer.parseInt(yytext().substring(8).trim());
+ }
+ case 281: break;
+ case 106:
+ { isIntWrap = true;
+ }
+ case 282: break;
+ case 133:
+ { yybegin(CTOR_ARG); ctorTypes.add(yytext().substring(8).trim());
+ }
+ case 283: break;
+ case 3:
+ { userCode.append(yytext());
+ }
+ case 284: break;
+ case 54:
+ { macroDefinition = false; yybegin(REGEXPSTART); return symbol(DELIMITER);
+ }
+ case 285: break;
+ case 129:
+ { functionName = yytext().substring(10).trim();
+ }
+ case 286: break;
+ case 85:
+ { classCode = conc(classCode,string); yybegin(MACROS);
+ }
+ case 287: break;
+ case 18:
+ { return symbol(QUESTION);
+ }
+ case 288: break;
+ case 50:
+ { if (commentbalance > 0)
+ commentbalance--;
+ else
+ yybegin(nextState);
+ }
+ case 289: break;
+ case 79:
+ { inclusive_states = true; yybegin(STATELIST);
+ }
+ case 290: break;
+ case 57:
+ { return symbol(CHAR, new Character( (char) Integer.parseInt(yytext().substring(1,yytext().length()), 8)));
+ }
+ case 291: break;
+ case 6:
+ {
+ }
+ case 292: break;
+ default:
+ if (zzInput == YYEOF && zzStartRead == zzCurrentPos) {
+ zzAtEOF = true;
+ zzDoEOF();
+ switch (zzLexicalState) {
+ case STRING_CONTENT: {
+ throw new ScannerException(file,ErrorMessages.EOF_IN_STRING);
+ }
+ case 827: break;
+ case MACROS: {
+ if ( yymoreStreams() ) {
+ file = (File) files.pop();
+ yypopStream();
+ }
+ else
+ throw new ScannerException(file,ErrorMessages.EOF_IN_MACROS);
+ }
+ case 828: break;
+ case STATELIST: {
+ throw new ScannerException(file,ErrorMessages.EOF_IN_MACROS);
+ }
+ case 829: break;
+ case CHARCLASS: {
+ throw new ScannerException(file,ErrorMessages.EOF_IN_REGEXP);
+ }
+ case 830: break;
+ case JAVA_CODE: {
+ throw new ScannerException(file,ErrorMessages.EOF_IN_ACTION, action_line-1);
+ }
+ case 831: break;
+ case REPEATEXP: {
+ throw new ScannerException(file,ErrorMessages.EOF_IN_REGEXP);
+ }
+ case 832: break;
+ case COMMENT: {
+ throw new ScannerException(file,ErrorMessages.EOF_IN_COMMENT);
+ }
+ case 833: break;
+ case STATES: {
+ throw new ScannerException(file,ErrorMessages.EOF_IN_STATES);
+ }
+ case 834: break;
+ case COPY: {
+ throw new ScannerException(file,ErrorMessages.EOF_IN_MACROS);
+ }
+ case 835: break;
+ default:
+ {
+ if ( yymoreStreams() ) {
+ file = (File) files.pop();
+ yypopStream();
+ }
+ else
+ return symbol(EOF);
+ }
+ }
+ }
+ else {
+ zzScanError(ZZ_NO_MATCH);
+ }
+ }
+ }
+ }
+
+ /**
+ * Converts an int token code into the name of the
+ * token by reflection on the cup symbol class/interface sym
+ *
+ * This code was contributed by Karl Meissner
+ */
+ private String getTokenName(int token) {
+ try {
+ java.lang.reflect.Field [] classFields = sym.class.getFields();
+ for (int i = 0; i < classFields.length; i++) {
+ if (classFields[i].getInt(null) == token) {
+ return classFields[i].getName();
+ }
+ }
+ } catch (Exception e) {
+ e.printStackTrace(System.err);
+ }
+
+ return "UNKNOWN TOKEN";
+ }
+
+ /**
+ * Same as next_token but also prints the token to standard out
+ * for debugging.
+ *
+ * This code was contributed by Karl Meissner
+ */
+ public Symbol debug_next_token() throws java.io.IOException {
+ java_cup.runtime.Symbol s = next_token();
+ System.out.println( "line:" + (yyline+1) + " col:" + (yycolumn+1) + " --"+ yytext() + "--" + getTokenName(s.sym) + "--");
+ return s;
+ }
+
+ /**
+ * Runs the scanner on input files.
+ *
+ * This main method is the debugging routine for the scanner.
+ * It prints debugging information about each returned token to
+ * System.out until the end of file is reached, or an error occured.
+ *
+ * @param argv the command line, contains the filenames to run
+ * the scanner on.
+ */
+ public static void main(String argv[]) {
+ if (argv.length == 0) {
+ System.out.println("Usage : java LexScan ");
+ }
+ else {
+ for (int i = 0; i < argv.length; i++) {
+ LexScan scanner = null;
+ try {
+ scanner = new LexScan( new java.io.FileReader(argv[i]) );
+ while ( !scanner.zzAtEOF ) scanner.debug_next_token();
+ }
+ catch (java.io.FileNotFoundException e) {
+ System.out.println("File not found : \""+argv[i]+"\"");
+ }
+ catch (java.io.IOException e) {
+ System.out.println("IO error scanning file \""+argv[i]+"\"");
+ System.out.println(e);
+ }
+ catch (Exception e) {
+ System.out.println("Unexpected exception:");
+ e.printStackTrace();
+ }
+ }
+ }
+ }
+
+
+}
Index: /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/src/JFlex/LexicalStates.java
===================================================================
--- /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/src/JFlex/LexicalStates.java (revision 25585)
+++ /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/src/JFlex/LexicalStates.java (revision 25585)
@@ -0,0 +1,97 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * JFlex 1.4.3 *
+ * Copyright (C) 1998-2009 Gerwin Klein *
+ * All rights reserved. *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License. See the file *
+ * COPYRIGHT for more information. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License along *
+ * with this program; if not, write to the Free Software Foundation, Inc., *
+ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *
+ * *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+package JFlex;
+
+import java.util.*;
+
+
+/**
+ * Simple symbol table, mapping lexical state names to integers.
+ *
+ * @author Gerwin Klein
+ * @version JFlex 1.4.3, $Revision: 433 $, $Date: 2009-01-31 19:52:34 +1100 (Sat, 31 Jan 2009) $
+ */
+public class LexicalStates {
+
+ /** maps state name to state number */
+ Hashtable states;
+
+ /** codes of inclusive states (subset of states) */
+ Vector inclusive;
+
+ /** number of declared states */
+ int numStates;
+
+
+ /**
+ * constructs a new lexical state symbol table
+ */
+ public LexicalStates() {
+ states = new Hashtable();
+ inclusive = new Vector();
+ }
+
+
+ /**
+ * insert a new state declaration
+ */
+ public void insert(String name, boolean is_inclusive) {
+ if ( states.containsKey(name) ) return;
+
+ Integer code = new Integer(numStates++);
+ states.put(name, code);
+
+ if (is_inclusive)
+ inclusive.addElement(code);
+ }
+
+
+ /**
+ * returns the number (code) of a declared state,
+ * null
if no such state has been declared.
+ */
+ public Integer getNumber(String name) {
+ return (Integer) states.get(name);
+ }
+
+
+ /**
+ * returns the number of declared states
+ */
+ public int number() {
+ return numStates;
+ }
+
+
+ /**
+ * returns the names of all states
+ */
+ public Enumeration names() {
+ return states.keys();
+ }
+
+ /**
+ * returns the code of all inclusive states
+ */
+ public Enumeration getInclusiveStates() {
+ return inclusive.elements();
+ }
+}
Index: /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/src/JFlex/MacroException.java
===================================================================
--- /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/src/JFlex/MacroException.java (revision 25585)
+++ /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/src/JFlex/MacroException.java (revision 25585)
@@ -0,0 +1,49 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * JFlex 1.4.3 *
+ * Copyright (C) 1998-2009 Gerwin Klein *
+ * All rights reserved. *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License. See the file *
+ * COPYRIGHT for more information. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License along *
+ * with this program; if not, write to the Free Software Foundation, Inc., *
+ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *
+ * *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+package JFlex;
+
+
+/**
+ * This Exception is used in the macro expander to report cycles or
+ * undefined macro usages.
+ *
+ * @author Gerwin Klein
+ * @version JFlex 1.4.3, $Revision: 433 $, $Date: 2009-01-31 19:52:34 +1100 (Sat, 31 Jan 2009) $
+ */
+public class MacroException extends RuntimeException {
+
+ /**
+ * Creates a new MacroException without message
+ */
+ public MacroException() {
+ }
+
+
+ /**
+ * Creates a new MacroException with the specified message
+ *
+ * @param message the error description presented to the user.
+ */
+ public MacroException(String message) {
+ super(message);
+ }
+
+}
Index: /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/src/JFlex/Macros.java
===================================================================
--- /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/src/JFlex/Macros.java (revision 25585)
+++ /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/src/JFlex/Macros.java (revision 25585)
@@ -0,0 +1,217 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * JFlex 1.4.3 *
+ * Copyright (C) 1998-2009 Gerwin Klein *
+ * All rights reserved. *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License. See the file *
+ * COPYRIGHT for more information. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License along *
+ * with this program; if not, write to the Free Software Foundation, Inc., *
+ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *
+ * *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+package JFlex;
+
+import java.util.*;
+
+
+/**
+ * Symbol table and expander for macros.
+ *
+ * Maps macros to their (expanded) definitions, detects cycles and
+ * unused macros.
+ *
+ * @author Gerwin Klein
+ * @version JFlex 1.4.3, $Revision: 433 $, $Date: 2009-01-31 19:52:34 +1100 (Sat, 31 Jan 2009) $
+ */
+final public class Macros {
+
+ /** Maps names of macros to their definition */
+ private Hashtable macros;
+
+ /** Maps names of macros to their "used" flag */
+ private Hashtable used;
+
+
+ /**
+ * Creates a new macro expander.
+ */
+ public Macros() {
+ macros = new Hashtable();
+ used = new Hashtable();
+ }
+
+
+ /**
+ * Stores a new macro and its definition.
+ *
+ * @param name the name of the new macro
+ * @param definition the definition of the new macro
+ *
+ * @return true
, iff the macro name has not been
+ * stored before.
+ */
+ public boolean insert(String name, RegExp definition) {
+
+ if (Options.DEBUG)
+ Out.debug("inserting macro "+name+" with definition :"+Out.NL+definition); //$NON-NLS-1$ //$NON-NLS-2$
+
+ used.put(name, Boolean.FALSE);
+ return macros.put(name,definition) == null;
+ }
+
+
+ /**
+ * Marks a makro as used.
+ *
+ * @return true
, iff the macro name has been
+ * stored before.
+ */
+ public boolean markUsed(String name) {
+ return used.put(name, Boolean.TRUE) != null;
+ }
+
+
+ /**
+ * Tests if a macro has been used.
+ *
+ * @return true
, iff the macro has been used in
+ * a regular expression.
+ */
+ public boolean isUsed(String name) {
+ return ((Boolean)used.get(name)).booleanValue();
+ }
+
+
+ /**
+ * Returns all unused macros.
+ *
+ * @return the enumeration of macro names that have not been used.
+ */
+ public Enumeration unused() {
+
+ Vector unUsed = new Vector();
+
+ Enumeration names = used.keys();
+ while ( names.hasMoreElements() ) {
+ String name = (String) names.nextElement();
+ Boolean isUsed = (Boolean) used.get( name );
+ if ( !isUsed.booleanValue() ) unUsed.addElement(name);
+ }
+
+ return unUsed.elements();
+ }
+
+
+ /**
+ * Fetches the definition of the macro with the specified name,
+ *
+ * The definition will either be the same as stored (expand() not
+ * called), or an equivalent one, that doesn't contain any macro
+ * usages (expand() called before).
+ *
+ * @param name the name of the macro
+ *
+ * @return the definition of the macro, null
if
+ * no macro with the specified name has been stored.
+ *
+ * @see JFlex.Macros#expand
+ */
+ public RegExp getDefinition(String name) {
+ return (RegExp) macros.get(name);
+ }
+
+
+ /**
+ * Expands all stored macros, so that getDefinition always returns
+ * a defintion that doesn't contain any macro usages.
+ *
+ * @throws MacroException if there is a cycle in the macro usage graph.
+ */
+ public void expand() throws MacroException {
+
+ Enumeration names;
+
+ names = macros.keys();
+
+ while ( names.hasMoreElements() ) {
+ String name = (String) names.nextElement();
+ if ( isUsed(name) )
+ macros.put(name, expandMacro(name, getDefinition(name)));
+ // this put doesn't get a new key, so only a new value
+ // is set for the key "name" (without changing the enumeration
+ // "names"!)
+ }
+ }
+
+
+ /**
+ * Expands the specified macro by replacing each macro usage
+ * with the stored definition.
+ *
+ * @param name the name of the macro to expand (for detecting cycles)
+ * @param definition the definition of the macro to expand
+ *
+ * @return the expanded definition of the macro.
+ *
+ * @throws MacroException when an error (such as a cyclic definition)
+ * occurs during expansion
+ */
+ private RegExp expandMacro(String name, RegExp definition) throws MacroException {
+
+ // Out.print("checking macro "+name);
+ // Out.print("definition is "+definition);
+
+ switch ( definition.type ) {
+ case sym.BAR:
+ case sym.CONCAT:
+ RegExp2 binary = (RegExp2) definition;
+ binary.r1 = expandMacro(name, binary.r1);
+ binary.r2 = expandMacro(name, binary.r2);
+ return definition;
+
+ case sym.STAR:
+ case sym.PLUS:
+ case sym.QUESTION:
+ case sym.BANG:
+ case sym.TILDE:
+ RegExp1 unary = (RegExp1) definition;
+ unary.content = expandMacro(name, (RegExp) unary.content);
+ return definition;
+
+ case sym.MACROUSE:
+ String usename = (String) ((RegExp1) definition).content;
+
+ if ( name.equals(usename) )
+ throw new MacroException(ErrorMessages.get(ErrorMessages.MACRO_CYCLE, name));
+
+ RegExp usedef = getDefinition(usename);
+
+ if ( usedef == null )
+ throw new MacroException(ErrorMessages.get(ErrorMessages.MACRO_DEF_MISSING, usename, name));
+
+ markUsed(usename);
+
+ return expandMacro(name, usedef);
+
+ case sym.STRING:
+ case sym.STRING_I:
+ case sym.CHAR:
+ case sym.CHAR_I:
+ case sym.CCLASS:
+ case sym.CCLASSNOT:
+ return definition;
+
+ default:
+ throw new MacroException("unknown expression type "+definition.type+" in macro expansion"); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+ }
+}
Index: /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/src/JFlex/Main.java
===================================================================
--- /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/src/JFlex/Main.java (revision 25585)
+++ /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/src/JFlex/Main.java (revision 25585)
@@ -0,0 +1,332 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * JFlex 1.4.3 *
+ * Copyright (C) 1998-2009 Gerwin Klein *
+ * All rights reserved. *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License. See the file *
+ * COPYRIGHT for more information. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License along *
+ * with this program; if not, write to the Free Software Foundation, Inc., *
+ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *
+ * *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+package JFlex;
+
+import java.io.*;
+import java.util.*;
+import JFlex.gui.MainFrame;
+
+
+/**
+ * This is the main class of JFlex controlling the scanner generation process.
+ * It is responsible for parsing the commandline, getting input files,
+ * starting up the GUI if necessary, etc.
+ *
+ * @author Gerwin Klein
+ * @version JFlex 1.4.3, $Revision: 433 $, $Date: 2009-01-31 19:52:34 +1100 (Sat, 31 Jan 2009) $
+ */
+public class Main {
+
+ /** JFlex version */
+ final public static String version = "1.4.3"; //$NON-NLS-1$
+
+ /**
+ * Generates a scanner for the specified input file.
+ *
+ * @param inputFile a file containing a lexical specification
+ * to generate a scanner for.
+ */
+ public static void generate(File inputFile) {
+
+ Out.resetCounters();
+
+ Timer totalTime = new Timer();
+ Timer time = new Timer();
+
+ LexScan scanner = null;
+ LexParse parser = null;
+ FileReader inputReader = null;
+
+ totalTime.start();
+
+ try {
+ Out.println(ErrorMessages.READING, inputFile.toString());
+ inputReader = new FileReader(inputFile);
+ scanner = new LexScan(inputReader);
+ scanner.setFile(inputFile);
+ parser = new LexParse(scanner);
+ }
+ catch (FileNotFoundException e) {
+ Out.error(ErrorMessages.CANNOT_OPEN, inputFile.toString());
+ throw new GeneratorException();
+ }
+
+ try {
+ NFA nfa = (NFA) parser.parse().value;
+
+ Out.checkErrors();
+
+ if (Options.dump) Out.dump(ErrorMessages.get(ErrorMessages.NFA_IS)+
+ Out.NL+nfa+Out.NL);
+
+ if (Options.dot)
+ nfa.writeDot(Emitter.normalize("nfa.dot", null)); //$NON-NLS-1$
+
+ Out.println(ErrorMessages.NFA_STATES, nfa.numStates);
+
+ time.start();
+ DFA dfa = nfa.getDFA();
+ time.stop();
+ Out.time(ErrorMessages.DFA_TOOK, time);
+
+ dfa.checkActions(scanner, parser);
+
+ nfa = null;
+
+ if (Options.dump) Out.dump(ErrorMessages.get(ErrorMessages.DFA_IS)+
+ Out.NL+dfa+Out.NL);
+
+ if (Options.dot)
+ dfa.writeDot(Emitter.normalize("dfa-big.dot", null)); //$NON-NLS-1$
+
+ Out.checkErrors();
+
+ time.start();
+ dfa.minimize();
+ time.stop();
+
+ Out.time(ErrorMessages.MIN_TOOK, time);
+
+ if (Options.dump)
+ Out.dump(ErrorMessages.get(ErrorMessages.MIN_DFA_IS)+
+ Out.NL+dfa);
+
+ if (Options.dot)
+ dfa.writeDot(Emitter.normalize("dfa-min.dot", null)); //$NON-NLS-1$
+
+ time.start();
+
+ Emitter e = new Emitter(inputFile, parser, dfa);
+ e.emit();
+
+ time.stop();
+
+ Out.time(ErrorMessages.WRITE_TOOK, time);
+
+ totalTime.stop();
+
+ Out.time(ErrorMessages.TOTAL_TIME, totalTime);
+ }
+ catch (ScannerException e) {
+ Out.error(e.file, e.message, e.line, e.column);
+ throw new GeneratorException();
+ }
+ catch (MacroException e) {
+ Out.error(e.getMessage());
+ throw new GeneratorException();
+ }
+ catch (IOException e) {
+ Out.error(ErrorMessages.IO_ERROR, e.toString());
+ throw new GeneratorException();
+ }
+ catch (OutOfMemoryError e) {
+ Out.error(ErrorMessages.OUT_OF_MEMORY);
+ throw new GeneratorException();
+ }
+ catch (GeneratorException e) {
+ throw new GeneratorException();
+ }
+ catch (Exception e) {
+ e.printStackTrace();
+ throw new GeneratorException();
+ }
+
+ }
+
+ public static Vector parseOptions(String argv[]) throws SilentExit {
+ Vector files = new Vector();
+
+ for (int i = 0; i < argv.length; i++) {
+
+ if ( argv[i].equals("-d") || argv[i].equals("--outdir") ) { //$NON-NLS-1$ //$NON-NLS-2$
+ if ( ++i >= argv.length ) {
+ Out.error(ErrorMessages.NO_DIRECTORY);
+ throw new GeneratorException();
+ }
+ Options.setDir(argv[i]);
+ continue;
+ }
+
+ if ( argv[i].equals("--skel") || argv[i].equals("-skel") ) { //$NON-NLS-1$ //$NON-NLS-2$
+ if ( ++i >= argv.length ) {
+ Out.error(ErrorMessages.NO_SKEL_FILE);
+ throw new GeneratorException();
+ }
+
+ Options.setSkeleton(new File(argv[i]));
+ continue;
+ }
+
+ if ( argv[i].equals("-jlex") || argv[i].equals("--jlex") ) { //$NON-NLS-1$ //$NON-NLS-2$
+ Options.jlex = true;
+ continue;
+ }
+
+ if ( argv[i].equals("-v") || argv[i].equals("--verbose") || argv[i].equals("-verbose") ) { //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ Options.verbose = true;
+ Options.progress = true;
+ continue;
+ }
+
+ if ( argv[i].equals("-q") || argv[i].equals("--quiet") || argv[i].equals("-quiet") ) { //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ Options.verbose = false;
+ Options.progress = false;
+ continue;
+ }
+
+ if ( argv[i].equals("--dump") || argv[i].equals("-dump") ) { //$NON-NLS-1$ //$NON-NLS-2$
+ Options.dump = true;
+ continue;
+ }
+
+ if ( argv[i].equals("--time") || argv[i].equals("-time") ) { //$NON-NLS-1$ //$NON-NLS-2$
+ Options.time = true;
+ continue;
+ }
+
+ if ( argv[i].equals("--version") || argv[i].equals("-version") ) { //$NON-NLS-1$ //$NON-NLS-2$
+ Out.println(ErrorMessages.THIS_IS_JFLEX, version);
+ throw new SilentExit();
+ }
+
+ if ( argv[i].equals("--dot") || argv[i].equals("-dot") ) { //$NON-NLS-1$ //$NON-NLS-2$
+ Options.dot = true;
+ continue;
+ }
+
+ if ( argv[i].equals("--help") || argv[i].equals("-h") || argv[i].equals("/h") ) { //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ printUsage();
+ throw new SilentExit();
+ }
+
+ if ( argv[i].equals("--info") || argv[i].equals("-info") ) { //$NON-NLS-1$ //$NON-NLS-2$
+ Out.printSystemInfo();
+ throw new SilentExit();
+ }
+
+ if ( argv[i].equals("--nomin") || argv[i].equals("-nomin") ) { //$NON-NLS-1$ //$NON-NLS-2$
+ Options.no_minimize = true;
+ continue;
+ }
+
+ if ( argv[i].equals("--pack") || argv[i].equals("-pack") ) { //$NON-NLS-1$ //$NON-NLS-2$
+ Options.gen_method = Options.PACK;
+ continue;
+ }
+
+ if ( argv[i].equals("--table") || argv[i].equals("-table") ) { //$NON-NLS-1$ //$NON-NLS-2$
+ Options.gen_method = Options.TABLE;
+ continue;
+ }
+
+ if ( argv[i].equals("--switch") || argv[i].equals("-switch") ) { //$NON-NLS-1$ //$NON-NLS-2$
+ Options.gen_method = Options.SWITCH;
+ continue;
+ }
+
+ if ( argv[i].equals("--nobak") || argv[i].equals("-nobak") ) { //$NON-NLS-1$ //$NON-NLS-2$
+ Options.no_backup = true;
+ continue;
+ }
+
+ if ( argv[i].startsWith("-") ) { //$NON-NLS-1$
+ Out.error(ErrorMessages.UNKNOWN_COMMANDLINE, argv[i]);
+ printUsage();
+ throw new SilentExit();
+ }
+
+ // if argv[i] is not an option, try to read it as file
+ File f = new File(argv[i]);
+ if ( f.isFile() && f.canRead() )
+ files.addElement(f);
+ else {
+ Out.error("Sorry, couldn't open \""+f+"\""); //$NON-NLS-2$
+ throw new GeneratorException();
+ }
+ }
+
+ return files;
+ }
+
+
+ public static void printUsage() {
+ Out.println(""); //$NON-NLS-1$
+ Out.println("Usage: jflex ");
+ Out.println("");
+ Out.println("Where can be one or more of");
+ Out.println("-d write generated file to ");
+ Out.println("--skel use external skeleton ");
+ Out.println("--switch");
+ Out.println("--table");
+ Out.println("--pack set default code generation method");
+ Out.println("--jlex strict JLex compatibility");
+ Out.println("--nomin skip minimization step");
+ Out.println("--nobak don't create backup files");
+ Out.println("--dump display transition tables");
+ Out.println("--dot write graphviz .dot files for the generated automata (alpha)");
+ Out.println("--verbose");
+ Out.println("-v display generation progress messages (default)");
+ Out.println("--quiet");
+ Out.println("-q display errors only");
+ Out.println("--time display generation time statistics");
+ Out.println("--version print the version number of this copy of jflex");
+ Out.println("--info print system + JDK information");
+ Out.println("--help");
+ Out.println("-h print this message");
+ Out.println("");
+ Out.println(ErrorMessages.THIS_IS_JFLEX, version);
+ Out.println("Have a nice day!");
+ }
+
+
+ public static void generate(String argv[]) throws SilentExit {
+ Vector files = parseOptions(argv);
+
+ if (files.size() > 0) {
+ for (int i = 0; i < files.size(); i++)
+ generate((File) files.elementAt(i));
+ }
+ else {
+ new MainFrame();
+ }
+ }
+
+
+ /**
+ * Starts the generation process with the files in argv
or
+ * pops up a window to choose a file, when argv
doesn't have
+ * any file entries.
+ *
+ * @param argv the commandline.
+ */
+ public static void main(String argv[]) {
+ try {
+ generate(argv);
+ }
+ catch (GeneratorException e) {
+ Out.statistics();
+ System.exit(1);
+ }
+ catch (SilentExit e) {
+ System.exit(1);
+ }
+ }
+}
Index: /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/src/JFlex/Messages.properties
===================================================================
--- /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/src/JFlex/Messages.properties (revision 25585)
+++ /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/src/JFlex/Messages.properties (revision 25585)
@@ -0,0 +1,74 @@
+UNTERMINATED_STR = Unterminated string at end of line.
+EOF_WO_ACTION = <> must be followed by an action.
+EOF_SINGLERULE = <> can only be used as a single rule.
+UNKNOWN_OPTION = Unkown %-option
+UNEXPECTED_CHAR = Unexpected character
+UNEXPECTED_NL = Unexpected character
+LEXSTATE_UNDECL = Lexical state has not been declared.
+STATE_IDENT_EXP = State identifier expected.
+REPEAT_ZERO = Illegal repeat statement. At least one operand must be > 0
+REPEAT_GREATER = Illegal repeat statement. First operand must not be greater than second one.
+REGEXP_EXPECTED = Regular expression expected.
+MACRO_UNDECL = Macro has not been declared.
+CHARSET_2_SMALL = Character set is too small for this class.
+CS2SMALL_STRING = Character set is too small for a charactor of this string.
+CS2SMALL_CHAR = Character set is too small for this character.
+CHARCLASS_MACRO = Macros in character classes are not supported.
+UNKNOWN_SYNTAX = Syntax error.
+SYNTAX_ERROR = Syntax error.
+NOT_AT_BOL = %-option is not at the beginning of the line.
+NO_MATCHING_BR = Didn't find matching bracket
+EOF_IN_ACTION = Unexpected end of file in action code
+EOF_IN_COMMENT = Unexpected end of file in comment
+EOF_IN_STRING = Unexpected end of file in string
+EOF_IN_MACROS = Unexpected end of file in macros
+EOF_IN_STATES = Unexpected end of file in state list
+EOF_IN_REGEXP = Unexpected end of file in regular expression
+UNEXPECTED_EOF = Unexpected end of file (maybe missing "*/" ")" "]" or "}")
+NO_LEX_SPEC = This seems not to be a lexical specification (first %% is missing)
+NO_LAST_ACTION = Last action in the specification must not be "|"
+NO_DIRECTORY = No directory for -d option
+NO_SKEL_FILE = No file provided for -skel option
+WRONG_SKELETON = Incorrect skeleton file (wrong number of sections).
+OUT_OF_MEMORY = JFlex has run out of memory. Please try increasing the maximum JVM heap size
+QUIL_INITTHROW = %initthrow needs a list of (qualified) identifiers
+QUIL_EOFTHROW = %eofthrow needs a list of (qualified) identifiers
+QUIL_YYLEXTHROW = %yylexthrow needs a list of (qualified) identifiers
+ZERO_STATES = Your scanner has zero states. Very funny.
+NO_BUFFER_SIZE = %buffer expects the size of the scanner buffer as decimal number
+NOT_READABLE = Could not open file.
+FILE_CYCLE = Cyclic file inclusion.
+FILE_WRITE = Error writing to file
+QUIL_SCANERROR = %scannerror needs a (qualified) identifier
+NEVER_MATCH = Rule can never be matched:
+QUIL_THROW = %throws needs a list of (qualified) identifiers
+EOL_IN_CHARCLASS = Unexpected newline in character class (closing "]" is missing)
+QUIL_CUPSYM = %cupsym needs a (qualified) identifier
+CUPSYM_AFTER_CUP = %cupsym should be used before %cup
+ALREADY_RUNNING = The generator is already running
+CANNOT_READ_SKEL = Cannot read skeleton file "{0}".
+READING_SKEL = Reading skeleton file "{0}".
+SKEL_IO_ERROR = IO problem reading skeleton file.
+SKEL_IO_ERROR_DEFAULT = IO problem reading default skeleton file.
+READING=Reading "{0}"
+CANNOT_OPEN=Sorry, couldn''t find the file "{0}".
+NFA_IS=NFA is
+NFA_STATES={0} states in NFA
+DFA_TOOK=DFA construction took {0}
+DFA_IS=DFA is
+MIN_TOOK=Minimization took {0}
+MIN_DFA_IS=Miniminal DFA is
+WRITE_TOOK=Writing took {0}
+TOTAL_TIME=Overall scanner generation time: {0}
+IO_ERROR=An I/O-Error occured: {0}
+THIS_IS_JFLEX=This is JFlex {0}
+UNKNOWN_COMMANDLINE=Error: unknown option "{0}".
+MACRO_CYCLE=Macro {0} contains a cycle.
+MACRO_DEF_MISSING=Found no definition for macro "{0}" while expanding "{1}"
+PARSING_TOOK=Parsing took {0}
+NFA_TOOK=NFA construction took {0}
+LOOKAHEAD_NEEDS_ACTION="|" action cannot be used with lookahead expressions
+EMPTY_MATCH = Lookahead expression must have match with at least length 1.
+CTOR_ARG = Expected an identifier for constructor argument name.
+CTOR_DEBUG = Emitting default constructor without parameters and init code for debug/standalone.
+INT_AND_TYPE = Scanner can't have int and reference return type at the same time.
Index: /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/src/JFlex/NFA.java
===================================================================
--- /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/src/JFlex/NFA.java (revision 25585)
+++ /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/src/JFlex/NFA.java (revision 25585)
@@ -0,0 +1,1052 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * JFlex 1.4.3 *
+ * Copyright (C) 1998-2009 Gerwin Klein *
+ * All rights reserved. *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License. See the file *
+ * COPYRIGHT for more information. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License along *
+ * with this program; if not, write to the Free Software Foundation, Inc., *
+ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *
+ * *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+package JFlex;
+
+import java.util.*;
+import java.io.*;
+
+
+/**
+ * NFA representation in JFlex.
+ *
+ * Contains algorithms RegExp -> NFA and NFA -> DFA.
+ *
+ * @author Gerwin Klein
+ * @version JFlex 1.4.3, $Revision: 433 $, $Date: 2009-01-31 19:52:34 +1100 (Sat, 31 Jan 2009) $
+ */
+final public class NFA {
+
+ /** table[current_state][next_char] is the set of states that can be reached
+ /* from current_state with an input next_char */
+ StateSet [][] table;
+
+ /** epsilon[current_state] is the set of states that can be reached
+ /* from current_state via epsilon edges */
+ StateSet [] epsilon;
+
+ /** isFinal[state] == true <=> state is a final state of the NFA */
+ boolean [] isFinal;
+
+ /** action[current_state]: the action associated with the state
+ /* current_state (null, if there is no action for the state) */
+ Action [] action;
+
+ /** the number of states in this NFA */
+ int numStates;
+
+ /** the current maximum number of input characters */
+ int numInput;
+
+ /** the number of lexical States. Lexical states have the indices
+ /* 0..numLexStates-1 in the transition table */
+ int numLexStates;
+
+ /** estimated size of the NFA (before actual construction) */
+ int estSize = 256;
+
+ Macros macros;
+ CharClasses classes;
+
+ LexScan scanner;
+ RegExps regExps;
+
+ // will be reused by several methods (avoids excessive object creation)
+ private static StateSetEnumerator states = new StateSetEnumerator();
+ private static StateSet tempStateSet = new StateSet();
+
+ public NFA(int numInput, int estSize) {
+ this.numInput = numInput;
+ this.estSize = estSize;
+ numStates = 0;
+ epsilon = new StateSet [estSize];
+ action = new Action [estSize];
+ isFinal = new boolean [estSize];
+ table = new StateSet [estSize][numInput];
+ }
+
+ /**
+ * Construct new NFA.
+ *
+ * Assumes that lookahead cases and numbers are already resolved in RegExps.
+ * @see RegExps#checkLookAheads()
+ */
+ public NFA(int numInput, LexScan scanner, RegExps regExps,
+ Macros macros, CharClasses classes) {
+ this(numInput, regExps.NFASize(macros)+2*scanner.states.number());
+
+ this.scanner = scanner;
+ this.regExps = regExps;
+ this.macros = macros;
+ this.classes = classes;
+
+ numLexStates = scanner.states.number();
+
+ // ensureCapacity assumes correctly set up numStates.
+ int new_num = numEntryStates();
+ ensureCapacity(new_num);
+ numStates = new_num;
+ }
+
+ public int numEntryStates() {
+ return 2*(numLexStates+regExps.gen_look_count);
+ }
+
+ /**
+ * Add a standalone rule that has minimum priority, fires a transition
+ * on all single input characters and has a "print yytext" action.
+ */
+ public void addStandaloneRule() {
+ int start = numStates;
+ int end = numStates+1;
+
+ for (int c = 0; c < classes.getNumClasses(); c++)
+ addTransition(start, c, end);
+
+ for (int i = 0; i < numLexStates*2; i++)
+ addEpsilonTransition(i, start);
+
+ action[end] = new Action("System.out.print(yytext());", Integer.MAX_VALUE);
+ isFinal[end] = true;
+ }
+
+ /**
+ * Add a regexp to this NFA.
+ *
+ * @param regExpNum the number of the regexp to add.
+ */
+ public void addRegExp(int regExpNum) {
+
+ if (Options.DEBUG)
+ Out.debug("Adding nfa for regexp "+regExpNum+" :"+Out.NL+regExps.getRegExp(regExpNum));
+
+ IntPair nfa = insertNFA( regExps.getRegExp(regExpNum) );
+
+ Enumeration lexStates = regExps.getStates(regExpNum).elements();
+
+ if ( !lexStates.hasMoreElements() )
+ lexStates = scanner.states.getInclusiveStates();
+
+ while ( lexStates.hasMoreElements() ) {
+ int stateNum = ((Integer)lexStates.nextElement()).intValue();
+
+ if ( !regExps.isBOL(regExpNum) )
+ addEpsilonTransition(2*stateNum, nfa.start);
+
+ addEpsilonTransition(2*stateNum+1, nfa.start);
+ }
+
+
+ if ( regExps.getLookAhead(regExpNum) != null ) {
+ Action a = regExps.getAction(regExpNum);
+
+ if (a.lookAhead() == Action.FINITE_CHOICE) {
+ insertLookAheadChoices(nfa.end, a, regExps.getLookAhead(regExpNum));
+ // remove the original action from the collection: it will never
+ // be matched directly, only its copies will.
+ scanner.actions.remove(a);
+ }
+ else {
+ RegExp r1 = regExps.getRegExp(regExpNum);
+ RegExp r2 = regExps.getLookAhead(regExpNum);
+
+ IntPair look = insertNFA(r2);
+
+ addEpsilonTransition(nfa.end, look.start);
+
+ action[look.end] = a;
+ isFinal[look.end] = true;
+
+ if (a.lookAhead() == Action.GENERAL_LOOK) {
+ // base forward pass
+ IntPair forward = insertNFA(r1);
+ // lookahead backward pass
+ IntPair backward = insertNFA(r2.rev(macros));
+
+ isFinal[forward.end] = true;
+ action[forward.end] = new Action(Action.FORWARD_ACTION);
+
+ isFinal[backward.end] = true;
+ action[backward.end] = new Action(Action.BACKWARD_ACTION);
+
+ int entry = 2*(regExps.getLookEntry(regExpNum) + numLexStates);
+ addEpsilonTransition(entry, forward.start);
+ addEpsilonTransition(entry+1, backward.start);
+
+ a.setEntryState(entry);
+ }
+ }
+ }
+ else {
+ action[nfa.end] = regExps.getAction(regExpNum);
+ isFinal[nfa.end] = true;
+ }
+ }
+
+ /**
+ * Insert NFAs for the (finitely many) fixed length lookahead choices.
+ *
+ * @param lookAhead a lookahead of which isFiniteChoice is true
+ * @param baseEnd the end state of the base expression NFA
+ * @param a the action of the expression
+ *
+ * @see SemCheck#isFiniteChoice(RegExp)
+ */
+ private void insertLookAheadChoices(int baseEnd, Action a, RegExp lookAhead) {
+ if (lookAhead.type == sym.BAR) {
+ RegExp2 r = (RegExp2) lookAhead;
+ insertLookAheadChoices(baseEnd, a, r.r1);
+ insertLookAheadChoices(baseEnd, a, r.r2);
+ }
+ else if (lookAhead.type == sym.MACROUSE) {
+ RegExp1 r = (RegExp1) lookAhead;
+ insertLookAheadChoices(baseEnd, a, macros.getDefinition((String) r.content));
+ }
+ else {
+ int len = SemCheck.length(lookAhead);
+
+ if (len >= 0) {
+ // termination case
+ IntPair look = insertNFA(lookAhead);
+
+ addEpsilonTransition(baseEnd, look.start);
+
+ Action x = a.copyChoice(len);
+ action[look.end] = x;
+ isFinal[look.end] = true;
+
+ // add new copy to the collection of known actions such that
+ // it can be checked for the NEVER_MATCH warning.
+ scanner.actions.add(x);
+ }
+ else {
+ // should never happen
+ throw new Error("When inserting lookahead expression: unkown expression type "+lookAhead.type+" in "+lookAhead); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+ }
+ }
+
+ /**
+ * Make sure the NFA can contain at least newNumStates states.
+ *
+ * @param newNumStates the minimu number of states.
+ */
+ private void ensureCapacity(int newNumStates) {
+ int oldLength = epsilon.length;
+
+ if ( newNumStates < oldLength ) return;
+
+ int newStatesLength = Math.max(oldLength*2, newNumStates);
+
+ boolean [] newFinal = new boolean [newStatesLength];
+ boolean [] newIsPush = new boolean [newStatesLength];
+ Action [] newAction = new Action [newStatesLength];
+ StateSet [] [] newTable = new StateSet [newStatesLength] [numInput];
+ StateSet [] newEpsilon = new StateSet [newStatesLength];
+
+ System.arraycopy(isFinal,0,newFinal,0,numStates);
+ System.arraycopy(action,0,newAction,0,numStates);
+ System.arraycopy(epsilon,0,newEpsilon,0,numStates);
+ System.arraycopy(table,0,newTable,0,numStates);
+
+ isFinal = newFinal;
+ action = newAction;
+ epsilon = newEpsilon;
+ table = newTable;
+ }
+
+ public void addTransition(int start, int input, int dest) {
+ Out.debug("Adding transition ("+start+", "+input+", "+dest+")");
+
+ int maxS = Math.max(start,dest)+1;
+
+ ensureCapacity( maxS );
+
+ if (maxS > numStates) numStates = maxS;
+
+ if ( table[start][input] != null )
+ table[start][input].addState(dest);
+ else
+ table[start][input] = new StateSet(estSize,dest);
+ }
+
+ public void addEpsilonTransition(int start, int dest) {
+ int max = Math.max(start,dest)+1;
+ ensureCapacity( max );
+ if (max > numStates) numStates = max;
+
+ if (epsilon[start] != null)
+ epsilon[start].addState(dest);
+ else
+ epsilon[start] = new StateSet(estSize,dest);
+ }
+
+
+ /**
+ * Returns true
, iff the specified set of states
+ * contains a final state.
+ *
+ * @param set the set of states that is tested for final states.
+ */
+ private boolean containsFinal(StateSet set) {
+ states.reset(set);
+
+ while ( states.hasMoreElements() )
+ if ( isFinal[states.nextElement()] ) return true;
+
+ return false;
+ }
+
+
+ /**
+ * Returns true
, iff the specified set of states
+ * contains a pushback-state.
+ *
+ * @param set the set of states that is tested for pushback-states.
+ private boolean containsPushback(StateSet set) {
+ states.reset(set);
+
+ while ( states.hasMoreElements() )
+ if ( isPushback[states.nextElement()] ) return true;
+
+ return false;
+ }
+ */
+
+ /**
+ * Returns the action with highest priority in the specified
+ * set of states.
+ *
+ * @param set the set of states for which to determine the action
+ */
+ private Action getAction(StateSet set) {
+
+ states.reset(set);
+
+ Action maxAction = null;
+
+ Out.debug("Determining action of : "+set);
+
+ while ( states.hasMoreElements() ) {
+
+ Action currentAction = action[ states.nextElement() ];
+
+ if ( currentAction != null ) {
+ if (maxAction == null)
+ maxAction = currentAction;
+ else
+ maxAction = maxAction.getHigherPriority(currentAction);
+ }
+
+ }
+
+ return maxAction;
+ }
+
+
+ /**
+ * Calculates the epsilon closure for a specified set of states.
+ *
+ * The epsilon closure for set a is the set of states that can be reached
+ * by epsilon edges from a.
+ *
+ * @param set the set of states to calculate the epsilon closure for
+ *
+ * @return the epsilon closure of the specified set of states
+ * in this NFA
+ */
+ private StateSet closure(int startState) {
+
+ // Out.debug("Calculating closure of "+set);
+
+ StateSet notvisited = tempStateSet;
+ StateSet closure = new StateSet(numStates,startState);
+
+ notvisited.clear();
+ notvisited.addState(startState);
+
+ while ( notvisited.containsElements() ) {
+ // Out.debug("closure is now "+closure);
+ // Out.debug("notvisited is "+notvisited);
+ int state = notvisited.getAndRemoveElement();
+ // Out.debug("removed element "+state+" of "+notvisited);
+ // Out.debug("epsilon[states] = "+epsilon[state]);
+ notvisited.add(closure.complement(epsilon[state]));
+ closure.add(epsilon[state]);
+ }
+
+ // Out.debug("Closure is : "+closure);
+
+ return closure;
+ }
+
+ /**
+ * Returns the epsilon closure of a set of states
+ */
+ private StateSet closure(StateSet startStates) {
+ StateSet result = new StateSet(numStates);
+
+ if (startStates != null) {
+ states.reset(startStates);
+ while (states.hasMoreElements())
+ result.add( closure(states.nextElement()) );
+ }
+
+ return result;
+ }
+
+
+ private void epsilonFill() {
+ for (int i = 0; i < numStates; i++) {
+ epsilon[i] = closure(i);
+ }
+ }
+
+ /**
+ * Calculates the set of states that can be reached from another
+ * set of states start
with an specified input
+ * character input
+ *
+ * @param start the set of states to start from
+ * @param input the input character for which to search the next states
+ *
+ * @return the set of states that are reached from start
+ * via input
+ */
+ private StateSet DFAEdge(StateSet start, char input) {
+ // Out.debug("Calculating DFAEdge for state set "+start+" and input '"+input+"'");
+
+ tempStateSet.clear();
+
+ states.reset(start);
+ while ( states.hasMoreElements() )
+ tempStateSet.add( table[states.nextElement()][input] );
+
+ StateSet result = new StateSet(tempStateSet);
+
+ states.reset(tempStateSet);
+ while ( states.hasMoreElements() )
+ result.add( epsilon[states.nextElement()] );
+
+ // Out.debug("DFAEdge is : "+result);
+
+ return result;
+ }
+
+
+ /**
+ * Returns an DFA that accepts the same language as this NFA.
+ * This DFA is usually not minimal.
+ */
+ public DFA getDFA() {
+
+ Hashtable dfaStates = new Hashtable(numStates);
+ Vector dfaVector = new Vector(numStates);
+
+ DFA dfa = new DFA(numEntryStates(), numInput, numLexStates);
+
+ int numDFAStates = 0;
+ int currentDFAState = 0;
+
+ Out.println("Converting NFA to DFA : ");
+
+ epsilonFill();
+
+ StateSet currentState, newState;
+
+ // create the initial states of the DFA
+ for ( int i = 0; i < numEntryStates(); i++ ) {
+ newState = epsilon[i];
+
+ dfaStates.put(newState, new Integer(numDFAStates));
+ dfaVector.addElement(newState);
+
+ dfa.setEntryState( i, numDFAStates );
+
+ dfa.setFinal( numDFAStates, containsFinal(newState) );
+ dfa.setAction( numDFAStates, getAction(newState) );
+
+ numDFAStates++;
+ }
+
+ numDFAStates--;
+
+ if (Options.DEBUG)
+ Out.debug("DFA start states are :"+Out.NL+dfaStates+Out.NL+Out.NL+"ordered :"+Out.NL+dfaVector);
+
+ currentDFAState = 0;
+
+ StateSet tempStateSet = NFA.tempStateSet;
+ StateSetEnumerator states = NFA.states;
+
+ // will be reused
+ newState = new StateSet(numStates);
+
+ while ( currentDFAState <= numDFAStates ) {
+
+ currentState = (StateSet) dfaVector.elementAt(currentDFAState);
+
+ for (char input = 0; input < numInput; input++) {
+
+ // newState = DFAEdge(currentState, input);
+
+ // inlining DFAEdge for performance:
+
+ // Out.debug("Calculating DFAEdge for state set "+currentState+" and input '"+input+"'");
+
+ tempStateSet.clear();
+ states.reset(currentState);
+ while ( states.hasMoreElements() )
+ tempStateSet.add( table[states.nextElement()][input] );
+
+ newState.copy(tempStateSet);
+
+ states.reset(tempStateSet);
+ while ( states.hasMoreElements() )
+ newState.add( epsilon[states.nextElement()] );
+
+ // Out.debug("DFAEdge is : "+newState);
+
+
+ if ( newState.containsElements() ) {
+
+ // Out.debug("DFAEdge for input "+(int)input+" and state set "+currentState+" is "+newState);
+
+ // Out.debug("Looking for state set "+newState);
+ Integer nextDFAState = (Integer) dfaStates.get(newState);
+
+ if ( nextDFAState != null ) {
+ // Out.debug("FOUND!");
+ dfa.addTransition(currentDFAState, input, nextDFAState.intValue());
+ }
+ else {
+ if (Options.progress) Out.print(".");
+ // Out.debug("NOT FOUND!");
+ // Out.debug("Table was "+dfaStates);
+ numDFAStates++;
+
+ // make a new copy of newState to store in dfaStates
+ StateSet storeState = new StateSet(newState);
+
+ dfaStates.put(storeState, new Integer(numDFAStates));
+ dfaVector.addElement(storeState);
+
+ dfa.addTransition(currentDFAState, input, numDFAStates);
+ dfa.setFinal( numDFAStates, containsFinal(storeState) );
+ dfa.setAction( numDFAStates, getAction(storeState) );
+ }
+ }
+ }
+
+ currentDFAState++;
+ }
+
+ if (Options.verbose) Out.println("");
+
+ return dfa;
+ }
+
+
+ public void dumpTable() {
+ Out.dump(toString());
+ }
+
+ public String toString() {
+ StringBuffer result = new StringBuffer();
+
+ for (int i=0; i < numStates; i++) {
+ result.append("State");
+ if ( isFinal[i] ) {
+ result.append("[FINAL");
+ String l = action[i].lookString();
+ if (!l.equals("")) {
+ result.append(", ");
+ result.append(l);
+ }
+ result.append("]");
+ }
+ result.append(" "+i+Out.NL);
+
+ for (char input = 0; input < numInput; input++) {
+ if ( table[i][input] != null && table[i][input].containsElements() )
+ result.append(" with "+((int) input)+" in "+table[i][input]+Out.NL);
+ }
+
+ if ( epsilon[i] != null && epsilon[i].containsElements() )
+ result.append(" with epsilon in "+epsilon[i]+Out.NL);
+ }
+
+ return result.toString();
+ }
+
+ public void writeDot(File file) {
+ try {
+ PrintWriter writer = new PrintWriter(new FileWriter(file));
+ writer.println(dotFormat());
+ writer.close();
+ }
+ catch (IOException e) {
+ Out.error(ErrorMessages.FILE_WRITE, file);
+ throw new GeneratorException();
+ }
+ }
+
+ public String dotFormat() {
+ StringBuffer result = new StringBuffer();
+
+ result.append("digraph NFA {"+Out.NL);
+ result.append("rankdir = LR"+Out.NL);
+
+ for (int i=0; i < numStates; i++) {
+ if ( isFinal[i] ) {
+ result.append(i);
+ result.append(" [shape = doublecircle]");
+ result.append(Out.NL);
+ }
+ }
+
+ for (int i=0; i < numStates; i++) {
+ for (int input = 0; input < numInput; input++) {
+ if ( table[i][input] != null ) {
+ StateSetEnumerator states = table[i][input].states();
+
+ while (states.hasMoreElements()) {
+ int s = states.nextElement();
+ result.append(i+" -> "+s);
+ result.append(" [label=\""+classes.toString(input)+"\"]"+Out.NL);
+ }
+ }
+ }
+ if ( epsilon[i] != null ) {
+ StateSetEnumerator states = epsilon[i].states();
+ while (states.hasMoreElements()) {
+ int s = states.nextElement();
+ result.append(i+" -> "+s+" [style=dotted]"+Out.NL);
+ }
+ }
+ }
+
+ result.append("}"+Out.NL);
+
+ return result.toString();
+ }
+
+
+ //-----------------------------------------------------------------------
+ // Functions for constructing NFAs out of regular expressions.
+
+ private void insertLetterNFA(boolean caseless, char letter, int start, int end) {
+ if (caseless) {
+ int lower = classes.getClassCode(Character.toLowerCase(letter));
+ int upper = classes.getClassCode(Character.toUpperCase(letter));
+ addTransition(start, lower, end);
+ if (upper != lower) addTransition(start, upper, end);
+ }
+ else {
+ addTransition(start, classes.getClassCode(letter), end);
+ }
+ }
+
+ private IntPair insertStringNFA(boolean caseless, String letters) {
+ int start = numStates;
+ int i;
+
+ for (i = 0; i < letters.length(); i++) {
+ if (caseless) {
+ char c = letters.charAt(i);
+ int lower = classes.getClassCode(Character.toLowerCase(c));
+ int upper = classes.getClassCode(Character.toUpperCase(c));
+ addTransition(i+start, lower, i+start+1);
+ if (upper != lower) addTransition(i+start, upper, i+start+1);
+ }
+ else {
+ addTransition(i+start, classes.getClassCode(letters.charAt(i)), i+start+1);
+ }
+ }
+
+ return new IntPair(start, i+start);
+ }
+
+
+ private void insertClassNFA(Vector intervalls, int start, int end) {
+ // empty char class is ok:
+ if (intervalls == null) return;
+
+ int [] cl = classes.getClassCodes(intervalls);
+ for (int i = 0; i < cl.length; i++)
+ addTransition(start, cl[i], end);
+ }
+
+ private void insertNotClassNFA(Vector intervalls, int start, int end) {
+ int [] cl = classes.getNotClassCodes(intervalls);
+
+ for (int i = 0; i < cl.length; i++)
+ addTransition(start, cl[i], end);
+ }
+
+
+ /**
+ * Constructs an NFA accepting the complement of the language
+ * of a given NFA.
+ *
+ * Converts the NFA into a DFA, then negates that DFA.
+ * Exponential state blowup possible and common.
+ *
+ * @param the NFA to construct the complement for.
+ *
+ * @return a pair of integers denoting the index of start
+ * and end state of the complement NFA.
+ */
+ private IntPair complement(IntPair nfa) {
+
+ if (Options.DEBUG) {
+ Out.debug("complement for "+nfa);
+ Out.debug("NFA is :"+Out.NL+this);
+ }
+
+ int dfaStart = nfa.end+1;
+
+ // FIXME: only need epsilon closure of states reachable from nfa.start
+ epsilonFill();
+
+ Hashtable dfaStates = new Hashtable(numStates);
+ Vector dfaVector = new Vector(numStates);
+
+ int numDFAStates = 0;
+ int currentDFAState = 0;
+
+ StateSet currentState, newState;
+
+ newState = epsilon[nfa.start];
+ dfaStates.put(newState, new Integer(numDFAStates));
+ dfaVector.addElement(newState);
+
+ if (Options.DEBUG)
+ Out.debug("pos DFA start state is :"+Out.NL+dfaStates+Out.NL+Out.NL+"ordered :"+Out.NL+dfaVector);
+
+ currentDFAState = 0;
+
+ while ( currentDFAState <= numDFAStates ) {
+
+ currentState = (StateSet) dfaVector.elementAt(currentDFAState);
+
+ for (char input = 0; input < numInput; input++) {
+ newState = DFAEdge(currentState, input);
+
+ if ( newState.containsElements() ) {
+
+ // Out.debug("DFAEdge for input "+(int)input+" and state set "+currentState+" is "+newState);
+
+ // Out.debug("Looking for state set "+newState);
+ Integer nextDFAState = (Integer) dfaStates.get(newState);
+
+ if ( nextDFAState != null ) {
+ // Out.debug("FOUND!");
+ addTransition(dfaStart+currentDFAState, input, dfaStart+nextDFAState.intValue());
+ }
+ else {
+ if (Options.dump) Out.print("+");
+ // Out.debug("NOT FOUND!");
+ // Out.debug("Table was "+dfaStates);
+ numDFAStates++;
+
+ dfaStates.put(newState, new Integer(numDFAStates));
+ dfaVector.addElement(newState);
+
+ addTransition(dfaStart+currentDFAState, input, dfaStart+numDFAStates);
+ }
+ }
+ }
+
+ currentDFAState++;
+ }
+
+ // We have a dfa accepting the positive regexp.
+
+ // Now the complement:
+ if (Options.DEBUG)
+ Out.debug("dfa finished, nfa is now :"+Out.NL+this);
+
+ int start = dfaStart+numDFAStates+1;
+ int error = dfaStart+numDFAStates+2;
+ int end = dfaStart+numDFAStates+3;
+
+ addEpsilonTransition(start, dfaStart);
+
+ for (int i = 0; i < numInput; i++)
+ addTransition(error, i, error);
+
+ addEpsilonTransition(error, end);
+
+ for (int s = 0; s <= numDFAStates; s++) {
+ currentState = (StateSet) dfaVector.elementAt(s);
+
+ currentDFAState = dfaStart+s;
+
+ // if it was not a final state, it is now in the complement
+ if (!currentState.isElement(nfa.end))
+ addEpsilonTransition(currentDFAState, end);
+
+ // all inputs not present (formerly leading to an implicit error)
+ // now lead to an explicit (final) state accepting everything.
+ for (int i = 0; i < numInput; i++)
+ if (table[currentDFAState][i] == null)
+ addTransition(currentDFAState, i, error);
+ }
+
+ // eliminate transitions leading to dead states
+ if (live == null || live.length < numStates) {
+ live = new boolean [2*numStates];
+ visited = new boolean [2*numStates];
+ }
+
+ removeDead(dfaStart, end);
+
+ if (Options.DEBUG)
+ Out.debug("complement finished, nfa ("+start+","+end+") is now :"+this);
+
+ return new IntPair(start, end);
+ }
+
+ // "global" data for use in method removeDead only:
+ // live[s] == false <=> no final state can be reached from s
+ private boolean [] live; // = new boolean [estSize];
+ private boolean [] visited; // = new boolean [estSize];
+
+ private void removeDead(int start, int end) {
+ // Out.debug("removeDead ("+start+")");
+
+ if ( visited[start] || live[start] ) return;
+ visited[start] = true;
+
+ // Out.debug("not yet visited");
+
+ if (closure(start).isElement(end))
+ live[start] = true;
+
+ // Out.debug("is final :"+live[start]);
+
+ for (int i = 0; i < numInput; i++) {
+ StateSet nextState = closure(table[start][i]);
+ StateSetEnumerator states = nextState.states();
+ while (states.hasMoreElements()) {
+ int next = states.nextElement();
+
+ if (next != start) {
+ removeDead(next,end);
+
+ if (live[next])
+ live[start] = true;
+ else
+ table[start][i] = null;
+ }
+ }
+ }
+
+ StateSet nextState = closure(epsilon[start]);
+ StateSetEnumerator states = nextState.states();
+ while (states.hasMoreElements()) {
+ int next = states.nextElement();
+
+ if (next != start) {
+ removeDead(next,end);
+
+ if (live[next])
+ live[start] = true;
+ }
+ }
+
+ // Out.debug("state "+start+" is live :"+live[start]);
+ }
+
+
+ /**
+ * Constructs a two state NFA for char class regexps,
+ * such that the NFA has
+ *
+ * exactly one start state,
+ * exactly one end state,
+ * no transitions leading out of the end state
+ * no transitions leading into the start state
+ *
+ * Assumes that regExp.isCharClass(macros) == true
+ *
+ * @param regExp the regular expression to construct the
+ * NFA for
+ *
+ * @return a pair of integers denoting the index of start
+ * and end state of the NFA.
+ */
+ private void insertCCLNFA(RegExp regExp, int start, int end) {
+ switch (regExp.type) {
+
+ case sym.BAR:
+ RegExp2 r = (RegExp2) regExp;
+ insertCCLNFA(r.r1, start, end);
+ insertCCLNFA(r.r2, start, end);
+ return;
+
+ case sym.CCLASS:
+ insertClassNFA( (Vector) ((RegExp1) regExp).content, start, end);
+ return;
+
+ case sym.CCLASSNOT:
+ insertNotClassNFA( (Vector) ((RegExp1) regExp).content, start, end);
+ return;
+
+ case sym.CHAR:
+ insertLetterNFA(
+ false, ((Character) ((RegExp1) regExp).content).charValue(),
+ start, end);
+ return;
+
+ case sym.CHAR_I:
+ insertLetterNFA(
+ true, ((Character) ((RegExp1) regExp).content).charValue(),
+ start, end);
+ return;
+
+ case sym.MACROUSE:
+ insertCCLNFA(macros.getDefinition((String) ((RegExp1) regExp).content),
+ start, end);
+ return;
+ }
+
+ throw new Error("Unknown expression type "+regExp.type+" in NFA construction");
+ }
+
+
+ /**
+ * Constructs an NFA for regExp such that the NFA has
+ *
+ * exactly one start state,
+ * exactly one end state,
+ * no transitions leading out of the end state
+ * no transitions leading into the start state
+ *
+ * @param regExp the regular expression to construct the
+ * NFA for
+ *
+ * @return a pair of integers denoting the index of start
+ * and end state of the NFA.
+ */
+ public IntPair insertNFA(RegExp regExp) {
+
+ IntPair nfa1, nfa2;
+ int start, end;
+ RegExp2 r;
+
+ if (Options.DEBUG)
+ Out.debug("Inserting RegExp : "+regExp);
+
+ if (regExp.isCharClass(macros)) {
+ start = numStates;
+ end = numStates+1;
+
+ ensureCapacity(end+1);
+ if (end+1 > numStates) numStates = end+1;
+
+ insertCCLNFA(regExp, start, end);
+
+ return new IntPair(start, end);
+ }
+
+ switch (regExp.type) {
+
+ case sym.BAR:
+
+ r = (RegExp2) regExp;
+
+ nfa1 = insertNFA(r.r1);
+ nfa2 = insertNFA(r.r2);
+
+ start = nfa2.end+1;
+ end = nfa2.end+2;
+
+ addEpsilonTransition(start, nfa1.start);
+ addEpsilonTransition(start, nfa2.start);
+ addEpsilonTransition(nfa1.end, end);
+ addEpsilonTransition(nfa2.end, end);
+
+ return new IntPair(start, end);
+
+ case sym.CONCAT:
+
+ r = (RegExp2) regExp;
+
+ nfa1 = insertNFA(r.r1);
+ nfa2 = insertNFA(r.r2);
+
+ addEpsilonTransition(nfa1.end, nfa2.start);
+
+ return new IntPair(nfa1.start, nfa2.end);
+
+ case sym.STAR:
+ nfa1 = insertNFA( (RegExp) ((RegExp1) regExp).content );
+
+ start = nfa1.end+1;
+ end = nfa1.end+2;
+
+ addEpsilonTransition(nfa1.end, end);
+ addEpsilonTransition(start, nfa1.start);
+
+ addEpsilonTransition(start, end);
+ addEpsilonTransition(nfa1.end, nfa1.start);
+
+ return new IntPair(start, end);
+
+ case sym.PLUS:
+ nfa1 = insertNFA( (RegExp) ((RegExp1) regExp).content );
+
+ start = nfa1.end+1;
+ end = nfa1.end+2;
+
+ addEpsilonTransition(nfa1.end, end);
+ addEpsilonTransition(start, nfa1.start);
+
+ addEpsilonTransition(nfa1.end, nfa1.start);
+
+ return new IntPair(start, end);
+
+ case sym.QUESTION:
+ nfa1 = insertNFA( (RegExp) ((RegExp1) regExp).content );
+
+ addEpsilonTransition(nfa1.start, nfa1.end);
+
+ return new IntPair(nfa1.start, nfa1.end);
+
+ case sym.BANG:
+ return complement(insertNFA((RegExp) ((RegExp1) regExp).content));
+
+ case sym.TILDE:
+ return insertNFA(regExp.resolveTilde(macros));
+
+ case sym.STRING:
+ return insertStringNFA(false, (String) ((RegExp1) regExp).content );
+
+ case sym.STRING_I:
+ return insertStringNFA(true, (String) ((RegExp1) regExp).content );
+
+ case sym.MACROUSE:
+ return insertNFA(macros.getDefinition((String) ((RegExp1) regExp).content));
+ }
+
+ throw new Error("Unknown expression type "+regExp.type+" in NFA construction");
+ }
+}
Index: /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/src/JFlex/Options.java
===================================================================
--- /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/src/JFlex/Options.java (revision 25585)
+++ /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/src/JFlex/Options.java (revision 25585)
@@ -0,0 +1,126 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * JFlex 1.4.3 *
+ * Copyright (C) 1998-2009 Gerwin Klein *
+ * All rights reserved. *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License. See the file *
+ * COPYRIGHT for more information. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License along *
+ * with this program; if not, write to the Free Software Foundation, Inc., *
+ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *
+ * *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+package JFlex;
+
+import java.io.File;
+
+/**
+ * Collects all global JFlex options. Can be set from command line parser,
+ * ant taks, gui, etc.
+ *
+ * @author Gerwin Klein
+ * @version JFlex 1.4.3, $Revision: 433 $, $Date: 2009-01-31 19:52:34 +1100 (Sat, 31 Jan 2009) $
+ */
+public class Options {
+
+ /** If true, additional verbose debug information is produced
+ * This is a compile time option */
+ public final static boolean DEBUG = false;
+
+ /** code generation method: maximum packing */
+ final public static int PACK = 0;
+ /** code generation method: traditional */
+ final public static int TABLE = 1;
+ /** code generation method: switch statement */
+ final public static int SWITCH = 2;
+
+
+ /** output directory */
+ private static File directory;
+ /** strict JLex compatibility */
+ public static boolean jlex;
+ /** don't run minimization algorithm if this is true */
+ public static boolean no_minimize;
+ /** don't write backup files if this is true */
+ public static boolean no_backup;
+ /** default code generation method */
+ public static int gen_method;
+ /** If false, only error/warning output will be generated */
+ public static boolean verbose;
+ /** If true, progress dots will be printed */
+ public static boolean progress;
+ /** If true, jflex will print time statistics about the generation process */
+ public static boolean time;
+ /** If true, jflex will write graphviz .dot files for generated automata */
+ public static boolean dot;
+ /** If true, you will be flooded with information (e.g. dfa tables). */
+ public static boolean dump;
+
+ static { setDefaults(); }
+
+
+ /**
+ * @return the output directory
+ */
+ public static File getDir() {
+ return directory;
+ }
+
+ /**
+ * Set output directory
+ *
+ * @param dirName the name of the directory to write output files to
+ */
+ public static void setDir(String dirName) {
+ setDir(new File(dirName));
+ }
+
+
+ /**
+ * Set output directory
+ *
+ * @param d the directory to write output files to
+ */
+ public static void setDir(File d) {
+ if ( d.isFile() ) {
+ Out.error("Error: \""+d+"\" is not a directory.");
+ throw new GeneratorException();
+ }
+
+ if ( !d.isDirectory() && !d.mkdirs() ) {
+ Out.error("Error: couldn't create directory \""+d+"\"");
+ throw new GeneratorException();
+ }
+
+ directory = d;
+ }
+
+ /**
+ * Sets all options back to default values.
+ */
+ public static void setDefaults() {
+ directory = null;
+ jlex = false;
+ no_minimize = false;
+ no_backup = false;
+ gen_method = Options.PACK;
+ verbose = true;
+ progress = true;
+ time = false;
+ dot = false;
+ dump = false;
+ Skeleton.readDefault();
+ }
+
+ public static void setSkeleton(File skel) {
+ Skeleton.readSkelFile(skel);
+ }
+}
Index: /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/src/JFlex/Out.java
===================================================================
--- /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/src/JFlex/Out.java (revision 25585)
+++ /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/src/JFlex/Out.java (revision 25585)
@@ -0,0 +1,461 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * JFlex 1.4.3 *
+ * Copyright (C) 1998-2009 Gerwin Klein *
+ * All rights reserved. *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License. See the file *
+ * COPYRIGHT for more information. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License along *
+ * with this program; if not, write to the Free Software Foundation, Inc., *
+ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *
+ * *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+package JFlex;
+
+
+import java.io.*;
+import java.awt.TextArea;
+
+
+/**
+ * In this class all output to the java console is filtered.
+ *
+ * Use the switches verbose, time and DUMP at compile time to determine
+ * the verbosity of JFlex output. There is no switch for
+ * suppressing error messages. verbose and time can be overridden
+ * by command line paramters.
+ *
+ * Redirects output to a TextArea in GUI mode.
+ *
+ * Counts error and warning messages.
+ *
+ * @author Gerwin Klein
+ * @version JFlex 1.4.3, $Revision: 433 $, $Date: 2009-01-31 19:52:34 +1100 (Sat, 31 Jan 2009) $
+ */
+public final class Out {
+
+ /** platform dependent newline sequence */
+ public static final String NL = System.getProperty("line.separator");
+
+ /** count total warnings */
+ private static int warnings;
+
+ /** count total errors */
+ private static int errors;
+
+ /** output device */
+ private static StdOutWriter out = new StdOutWriter();
+
+
+ /**
+ * Switches to GUI mode if text
is not null
+ *
+ * @param text the message TextArea of the JFlex GUI
+ */
+ public static void setGUIMode(TextArea text) {
+ out.setGUIMode(text);
+ }
+
+ /**
+ * Sets a new output stream and switches to non-gui mode.
+ *
+ * @param stream the new output stream
+ */
+ public static void setOutputStream(OutputStream stream) {
+ out = new StdOutWriter(stream);
+ out.setGUIMode(null);
+ }
+
+ /**
+ * Report time statistic data.
+ *
+ * @param message the message to be printed
+ * @param time elapsed time
+ */
+ public static void time(ErrorMessages message, Timer time) {
+ if (Options.time) {
+ String msg = ErrorMessages.get(message, time.toString());
+ out.println(msg);
+ }
+ }
+
+ /**
+ * Report time statistic data.
+ *
+ * @param message the message to be printed
+ */
+ public static void time(String message) {
+ if (Options.time) {
+ out.println(message);
+ }
+ }
+
+ /**
+ * Report generation progress.
+ *
+ * @param message the message to be printed
+ */
+ public static void println(String message) {
+ if (Options.verbose)
+ out.println(message);
+ }
+
+ /**
+ * Report generation progress.
+ *
+ * @param message the message to be printed
+ * @param data data to be inserted into the message
+ */
+ public static void println(ErrorMessages message, String data) {
+ if (Options.verbose) {
+ out.println(ErrorMessages.get(message,data));
+ }
+ }
+
+ /**
+ * Report generation progress.
+ *
+ * @param message the message to be printed
+ * @param data data to be inserted into the message
+ */
+ public static void println(ErrorMessages message, int data) {
+ if (Options.verbose) {
+ out.println(ErrorMessages.get(message,data));
+ }
+ }
+
+ /**
+ * Report generation progress.
+ *
+ * @param message the message to be printed
+ */
+ public static void print(String message) {
+ if (Options.verbose) out.print(message);
+ }
+
+ /**
+ * Dump debug information to System.out
+ *
+ * Use like this
+ *
+ * if (Out.DEBUG) Out.debug(message)
+ *
+ * to save performance during normal operation (when DEBUG
+ * is turned off).
+ */
+ public static void debug(String message) {
+ if (Options.DEBUG) System.out.println(message);
+ }
+
+
+ /**
+ * All parts of JFlex, that want to provide dump information
+ * should use this method for their output.
+ *
+ * @message the message to be printed
+ */
+ public static void dump(String message) {
+ if (Options.dump) out.println(message);
+ }
+
+
+ /**
+ * All parts of JFlex, that want to report error messages
+ * should use this method for their output.
+ *
+ * @message the message to be printed
+ */
+ private static void err(String message) {
+ out.println(message);
+ }
+
+
+ /**
+ * throws a GeneratorException if there are any errors recorded
+ */
+ public static void checkErrors() {
+ if (errors > 0) throw new GeneratorException();
+ }
+
+
+ /**
+ * print error and warning statistics
+ */
+ public static void statistics() {
+ StringBuffer line = new StringBuffer(errors+" error");
+ if (errors != 1) line.append("s");
+
+ line.append(", "+warnings+" warning");
+ if (warnings != 1) line.append("s");
+
+ line.append(".");
+ err(line.toString());
+ }
+
+
+ /**
+ * reset error and warning counters
+ */
+ public static void resetCounters() {
+ errors = 0;
+ warnings = 0;
+ }
+
+
+ /**
+ * print a warning without position information
+ *
+ * @param message the warning message
+ */
+ public static void warning(String message) {
+ warnings++;
+
+ err(NL+"Warning : "+message);
+ }
+
+
+ /**
+ * print a warning with line information
+ *
+ * @param message code of the warning message
+ * @param line the line information
+ *
+ * @see ErrorMessages
+ */
+ public static void warning(ErrorMessages message, int line) {
+ warnings++;
+
+ String msg = NL+"Warning";
+ if (line > 0) msg = msg+" in line "+(line+1);
+
+ err(msg+": "+ErrorMessages.get(message));
+ }
+
+
+ /**
+ * print warning message with location information
+ *
+ * @param file the file the warning is issued for
+ * @param message the code of the message to print
+ * @param line the line number of the position
+ * @param column the column of the position
+ */
+ public static void warning(File file, ErrorMessages message, int line, int column) {
+
+ String msg = NL+"Warning";
+ if (file != null) msg += " in file \""+file+"\"";
+ if (line >= 0) msg = msg+" (line "+(line+1)+")";
+
+ try {
+ err(msg+": "+NL+ErrorMessages.get(message));
+ }
+ catch (ArrayIndexOutOfBoundsException e) {
+ err(msg);
+ }
+
+ warnings++;
+
+ if (line >= 0) {
+ if (column >= 0)
+ showPosition(file, line, column);
+ else
+ showPosition(file, line);
+ }
+ }
+
+
+ /**
+ * print error message (string)
+ *
+ * @param message the message to print
+ */
+ public static void error(String message) {
+ errors++;
+ err(NL+message);
+ }
+
+
+ /**
+ * print error message (code)
+ *
+ * @param message the code of the error message
+ *
+ * @see ErrorMessages
+ */
+ public static void error(ErrorMessages message) {
+ errors++;
+ err(NL+"Error: "+ErrorMessages.get(message) );
+ }
+
+
+ /**
+ * print error message with data
+ *
+ * @param data data to insert into the message
+ * @param message the code of the error message
+ *
+ * @see ErrorMessages
+ */
+ public static void error(ErrorMessages message, String data) {
+ errors++;
+ err(NL+"Error: "+ ErrorMessages.get(message,data));
+ }
+
+
+ /**
+ * IO error message for a file (displays file
+ * name in parentheses).
+ *
+ * @param message the code of the error message
+ * @param file the file it occurred for
+ */
+ public static void error(ErrorMessages message, File file) {
+ errors++;
+ err(NL+"Error: "+ErrorMessages.get(message)+" ("+file+")");
+ }
+
+
+ /**
+ * print error message with location information
+ *
+ * @param file the file the error occurred for
+ * @param message the code of the error message to print
+ * @param line the line number of error position
+ * @param column the column of error position
+ */
+ public static void error(File file, ErrorMessages message, int line, int column) {
+
+ String msg = NL+"Error";
+ if (file != null) msg += " in file \""+file+"\"";
+ if (line >= 0) msg = msg+" (line "+(line+1)+")";
+
+ try {
+ err(msg+": "+NL+ErrorMessages.get(message));
+ }
+ catch (ArrayIndexOutOfBoundsException e) {
+ err(msg);
+ }
+
+ errors++;
+
+ if (line >= 0) {
+ if (column >= 0)
+ showPosition(file, line, column);
+ else
+ showPosition(file, line);
+ }
+ }
+
+
+ /**
+ * prints a line of a file with marked position.
+ *
+ * @param file the file of which to show the line
+ * @param line the line to show
+ * @param column the column in which to show the marker
+ */
+ public static void showPosition(File file, int line, int column) {
+ try {
+ String ln = getLine(file, line);
+ if (ln != null) {
+ err( ln );
+
+ if (column < 0) return;
+
+ String t = "^";
+ for (int i = 0; i < column; i++) t = " "+t;
+
+ err(t);
+ }
+ }
+ catch (IOException e) {
+ /* silently ignore IO errors, don't show anything */
+ }
+ }
+
+
+ /**
+ * print a line of a file
+ *
+ * @param file the file to show
+ * @param line the line number
+ */
+ public static void showPosition(File file, int line) {
+ try {
+ String ln = getLine(file, line);
+ if (ln != null) err(ln);
+ }
+ catch (IOException e) {
+ /* silently ignore IO errors, don't show anything */
+ }
+ }
+
+
+ /**
+ * get one line from a file
+ *
+ * @param file the file to read
+ * @param line the line number to get
+ *
+ * @throw IOException if any error occurs
+ */
+ private static String getLine(File file, int line) throws IOException {
+ BufferedReader reader = new BufferedReader(new FileReader(file));
+
+ String msg = "";
+
+ for (int i = 0; i <= line; i++)
+ msg = reader.readLine();
+
+ reader.close();
+
+ return msg;
+ }
+
+
+ /**
+ * Print system information (e.g. in case of unexpected exceptions)
+ */
+ public static void printSystemInfo() {
+ err("Java version: "+System.getProperty("java.version"));
+ err("Runtime name: "+System.getProperty("java.runtime.name"));
+ err("Vendor: "+System.getProperty("java.vendor"));
+ err("VM version: "+System.getProperty("java.vm.version"));
+ err("VM vendor: "+System.getProperty("java.vm.vendor"));
+ err("VM name: "+System.getProperty("java.vm.name"));
+ err("VM info: "+System.getProperty("java.vm.info"));
+ err("OS name: "+System.getProperty("os.name"));
+ err("OS arch: "+System.getProperty("os.arch"));
+ err("OS version: "+System.getProperty("os.version"));
+ err("Encoding: "+System.getProperty("file.encoding"));
+ err("JFlex version: "+Main.version);
+ }
+
+
+ /**
+ * Request a bug report for an unexpected Exception/Error.
+ */
+ public static void requestBugReport(Error e) {
+ err("An unexpected error occurred. Please send a report of this to");
+ err(" and include the following information:");
+ err("");
+ printSystemInfo();
+ err("Exception:");
+ e.printStackTrace(out);
+ err("");
+ err("Please also include a specification (as small as possible)");
+ err("that triggers this error. You may also want to check at");
+ err("http://www.jflex.de if there is a newer version available");
+ err("that doesn't have this problem");
+ err("");
+ err("Thanks for your support.");
+ }
+}
Index: /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/src/JFlex/PackEmitter.java
===================================================================
--- /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/src/JFlex/PackEmitter.java (revision 25585)
+++ /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/src/JFlex/PackEmitter.java (revision 25585)
@@ -0,0 +1,230 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * jflex 1.4 *
+ * Copyright (C) 1998-2009 Gerwin Klein *
+ * All rights reserved. *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License. See the file *
+ * COPYRIGHT for more information. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License along *
+ * with this program; if not, write to the Free Software Foundation, Inc., *
+ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *
+ * *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+package JFlex;
+
+
+/**
+ * Encodes int
arrays as strings.
+ *
+ * Also splits up strings when longer than 64K in UTF8 encoding.
+ * Subclasses emit unpacking code.
+ *
+ * Usage protocol:
+ * p.emitInit();
+ * for each data: p.emitData(data);
+ * p.emitUnpack();
+ *
+ * @author Gerwin Klein
+ * @version $Revision: 433 $, $Date: 2009-01-31 19:52:34 +1100 (Sat, 31 Jan 2009) $
+ */
+public abstract class PackEmitter {
+
+ /** name of the generated array (mixed case, no yy prefix) */
+ protected String name;
+
+ /** current UTF8 length of generated string in current chunk */
+ private int UTF8Length;
+
+ /** position in the current line */
+ private int linepos;
+
+ /** max number of entries per line */
+ private static final int maxEntries = 16;
+
+ /** output buffer */
+ protected StringBuffer out = new StringBuffer();
+
+ /** number of existing string chunks */
+ protected int chunks;
+
+ /** maximum size of chunks */
+ // String constants are stored as UTF8 with 2 bytes length
+ // field in class files. One Unicode char can be up to 3
+ // UTF8 bytes. 64K max and two chars safety.
+ private static final int maxSize = 0xFFFF-6;
+
+ /** indent for string lines */
+ private static final String indent = " ";
+
+ /**
+ * Create new emitter for an array.
+ *
+ * @param name the name of the generated array
+ */
+ public PackEmitter(String name) {
+ this.name = name;
+ }
+
+ /**
+ * Convert array name into all uppercase internal scanner
+ * constant name.
+ *
+ * @return name
as a internal constant name.
+ * @see PackEmitter#name
+ */
+ protected String constName() {
+ return "ZZ_" + name.toUpperCase();
+ }
+
+ /**
+ * Return current output buffer.
+ */
+ public String toString() {
+ return out.toString();
+ }
+
+ /**
+ * Emit declaration of decoded member and open first chunk.
+ */
+ public void emitInit() {
+ out.append(" private static final int [] ");
+ out.append(constName());
+ out.append(" = zzUnpack");
+ out.append(name);
+ out.append("();");
+ nl();
+ nextChunk();
+ }
+
+ /**
+ * Emit single unicode character.
+ *
+ * Updates length, position, etc.
+ *
+ * @param i the character to emit.
+ * @prec 0 <= i <= 0xFFFF
+ */
+ public void emitUC(int i) {
+ if (i < 0 || i > 0xFFFF)
+ throw new IllegalArgumentException("character value expected");
+
+ // cast ok because of prec
+ char c = (char) i;
+
+ printUC(c);
+ UTF8Length += UTF8Length(c);
+ linepos++;
+ }
+
+ /**
+ * Execute line/chunk break if necessary.
+ * Leave space for at least two chars.
+ */
+ public void breaks() {
+ if (UTF8Length >= maxSize) {
+ // close current chunk
+ out.append("\";");
+ nl();
+
+ nextChunk();
+ }
+ else {
+ if (linepos >= maxEntries) {
+ // line break
+ out.append("\"+");
+ nl();
+ out.append(indent);
+ out.append("\"");
+ linepos = 0;
+ }
+ }
+ }
+
+ /**
+ * Emit the unpacking code.
+ */
+ public abstract void emitUnpack();
+
+ /**
+ * emit next chunk
+ */
+ private void nextChunk() {
+ nl();
+ out.append(" private static final String ");
+ out.append(constName());
+ out.append("_PACKED_");
+ out.append(chunks);
+ out.append(" =");
+ nl();
+ out.append(indent);
+ out.append("\"");
+
+ UTF8Length = 0;
+ linepos = 0;
+ chunks++;
+ }
+
+ /**
+ * emit newline
+ */
+ protected void nl() {
+ out.append(Out.NL);
+ }
+
+ /**
+ * Append a unicode/octal escaped character
+ * to out
buffer.
+ *
+ * @param c the character to append
+ */
+ private void printUC(char c) {
+ if (c > 255) {
+ out.append("\\u");
+ if (c < 0x1000) out.append("0");
+ out.append(Integer.toHexString(c));
+ }
+ else {
+ out.append("\\");
+ out.append(Integer.toOctalString(c));
+ }
+ }
+
+ /**
+ * Calculates the number of bytes a Unicode character
+ * would have in UTF8 representation in a class file.
+ *
+ * @param value the char code of the Unicode character
+ * @prec 0 <= value <= 0xFFFF
+ *
+ * @return length of UTF8 representation.
+ */
+ private int UTF8Length(char value) {
+ // if (value < 0 || value > 0xFFFF) throw new Error("not a char value ("+value+")");
+
+ // see JVM spec section 4.4.7, p 111
+ if (value == 0) return 2;
+ if (value <= 0x7F) return 1;
+
+ // workaround for javac bug (up to jdk 1.3):
+ if (value < 0x0400) return 2;
+ if (value <= 0x07FF) return 3;
+
+ // correct would be:
+ // if (value <= 0x7FF) return 2;
+ return 3;
+ }
+
+ // convenience
+ protected void println(String s) {
+ out.append(s);
+ nl();
+ }
+}
Index: /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/src/JFlex/RegExp.java
===================================================================
--- /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/src/JFlex/RegExp.java (revision 25585)
+++ /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/src/JFlex/RegExp.java (revision 25585)
@@ -0,0 +1,332 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * JFlex 1.4.3 *
+ * Copyright (C) 1998-2009 Gerwin Klein *
+ * All rights reserved. *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License. See the file *
+ * COPYRIGHT for more information. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License along *
+ * with this program; if not, write to the Free Software Foundation, Inc., *
+ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *
+ * *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+package JFlex;
+
+import java.util.Vector;
+
+/**
+ * Stores a regular expression of rules section in a JFlex-specification.
+ *
+ * This base class has no content other than its type.
+ *
+ * @author Gerwin Klein
+ * @version JFlex 1.4.3, $Revision: 433 $, $Date: 2009-01-31 19:52:34 +1100 (Sat, 31 Jan 2009) $
+ */
+public class RegExp {
+
+ /**
+ * The type of the regular expression. This field will be
+ * filled with values from class sym.java (generated by cup)
+ */
+ int type;
+
+
+ /**
+ * Create a new regular expression of the specified type.
+ *
+ * @param type a value from the cup generated class sym.
+ *
+ * @see JFlex.sym
+ */
+ public RegExp(int type) {
+ this.type = type;
+ }
+
+
+
+ /**
+ * Returns a String-representation of this regular expression
+ * with the specified indentation.
+ *
+ * @param tab a String that should contain only space characters and
+ * that is inserted in front of standard String-representation
+ * pf this object.
+ */
+ public String print(String tab) {
+ return tab+toString();
+ }
+
+
+ /**
+ * Returns a String-representation of this regular expression
+ */
+ public String toString() {
+ return "type = "+type;
+ }
+
+
+ /**
+ * Find out if this regexp is a char class or equivalent to one.
+ *
+ * @param macros for macro expansion
+ * @return true if the regexp is equivalent to a char class.
+ */
+ public boolean isCharClass(Macros macros) {
+ RegExp1 unary;
+ RegExp2 binary;
+
+ switch (type) {
+ case sym.CHAR:
+ case sym.CHAR_I:
+ case sym.CCLASS:
+ case sym.CCLASSNOT:
+ return true;
+
+ case sym.BAR:
+ binary = (RegExp2) this;
+ return binary.r1.isCharClass(macros) && binary.r2.isCharClass(macros);
+
+ case sym.MACROUSE:
+ unary = (RegExp1) this;
+ return macros.getDefinition((String) unary.content).isCharClass(macros);
+
+ default: return false;
+ }
+ }
+
+ /**
+ * The approximate number of NFA states this expression will need (only
+ * works correctly after macro expansion and without negation)
+ *
+ * @param macros macro table for expansion
+ */
+ public int size(Macros macros) {
+ RegExp1 unary;
+ RegExp2 binary;
+ RegExp content;
+
+ switch ( type ) {
+ case sym.BAR:
+ binary = (RegExp2) this;
+ return binary.r1.size(macros) + binary.r2.size(macros) + 2;
+
+ case sym.CONCAT:
+ binary = (RegExp2) this;
+ return binary.r1.size(macros) + binary.r2.size(macros);
+
+ case sym.STAR:
+ unary = (RegExp1) this;
+ content = (RegExp) unary.content;
+ return content.size(macros) + 2;
+
+ case sym.PLUS:
+ unary = (RegExp1) this;
+ content = (RegExp) unary.content;
+ return content.size(macros) + 2;
+
+ case sym.QUESTION:
+ unary = (RegExp1) this;
+ content = (RegExp) unary.content;
+ return content.size(macros);
+
+ case sym.BANG:
+ unary = (RegExp1) this;
+ content = (RegExp) unary.content;
+ return content.size(macros) * content.size(macros);
+ // this is only a very rough estimate (worst case 2^n)
+ // exact size too complicated (propably requires construction)
+
+ case sym.TILDE:
+ unary = (RegExp1) this;
+ content = (RegExp) unary.content;
+ return content.size(macros) * content.size(macros) * 3;
+ // see sym.BANG
+
+ case sym.STRING:
+ case sym.STRING_I:
+ unary = (RegExp1) this;
+ return ((String) unary.content).length()+1;
+
+ case sym.CHAR:
+ case sym.CHAR_I:
+ return 2;
+
+ case sym.CCLASS:
+ case sym.CCLASSNOT:
+ return 2;
+
+ case sym.MACROUSE:
+ unary = (RegExp1) this;
+ return macros.getDefinition((String) unary.content).size(macros);
+ }
+
+ throw new Error("unknown regexp type "+type);
+ }
+
+ /**
+ * @return the reverse of the specified string.
+ */
+ public final static String revString(String s) {
+ StringBuffer b = new StringBuffer(s.length());
+ for (int i=s.length()-1; i >= 0; i--) {
+ b.append(s.charAt(i));
+ }
+ return b.toString();
+ }
+
+ /**
+ * Recursively convert tilde (upto) expressions into negation and star.
+ *
+ * @param macros the macro table for expansion.
+ * @return new RegExp equivalent to the current one, but without upto expressions.
+ */
+ public final RegExp resolveTilde(Macros macros) {
+ RegExp1 unary;
+ RegExp2 binary;
+ RegExp content;
+
+ switch ( type ) {
+ case sym.BAR:
+ binary = (RegExp2) this;
+ return new RegExp2(sym.BAR, binary.r1.resolveTilde(macros),
+ binary.r2.resolveTilde(macros));
+
+ case sym.CONCAT:
+ binary = (RegExp2) this;
+ return new RegExp2(sym.CONCAT, binary.r1.resolveTilde(macros),
+ binary.r2.resolveTilde(macros));
+
+ case sym.STAR:
+ unary = (RegExp1) this;
+ content = (RegExp) unary.content;
+ return new RegExp1(sym.STAR, content.resolveTilde(macros));
+
+ case sym.PLUS:
+ unary = (RegExp1) this;
+ content = (RegExp) unary.content;
+ return new RegExp1(sym.PLUS, content.resolveTilde(macros));
+
+ case sym.QUESTION:
+ unary = (RegExp1) this;
+ content = (RegExp) unary.content;
+ return new RegExp1(sym.QUESTION, content.resolveTilde(macros));
+
+ case sym.BANG:
+ unary = (RegExp1) this;
+ content = (RegExp) unary.content;
+ return new RegExp1(sym.BANG, content.resolveTilde(macros));
+
+ case sym.TILDE:
+ // ~a = !([^]* a [^]*) a
+ // uses subexpression sharing
+ unary = (RegExp1) this;
+ content = ((RegExp) unary.content).resolveTilde(macros);
+
+ RegExp any_star = new RegExp1(sym.STAR, anyChar());
+ RegExp neg = new RegExp1(sym.BANG,
+ new RegExp2(sym.CONCAT, any_star,
+ new RegExp2(sym.CONCAT, content, any_star)));
+
+ return new RegExp2(sym.CONCAT, neg, content);
+
+ case sym.STRING:
+ case sym.STRING_I:
+ case sym.CHAR:
+ case sym.CHAR_I:
+ case sym.CCLASS:
+ case sym.CCLASSNOT:
+ unary = (RegExp1) this;
+ return new RegExp1(unary.type, unary.content);
+
+ case sym.MACROUSE:
+ unary = (RegExp1) this;
+ return macros.getDefinition((String) unary.content).resolveTilde(macros);
+ }
+
+ throw new Error("unknown regexp type "+type);
+ }
+
+
+ /**
+ * Returns a regexp that matches any character: [^]
+ * @return the regexp for [^]
+ */
+ public RegExp anyChar() {
+ // FIXME: there is some code duplication here with the parser
+ Vector list = new Vector();
+ list.addElement(new Interval((char)0,CharClasses.maxChar));
+ return new RegExp1(sym.CCLASS,list);
+ }
+
+
+ /**
+ * Create a new regexp that matches the reverse text of this one.
+ *
+ * @return the reverse regexp
+ */
+ public final RegExp rev(Macros macros) {
+ RegExp1 unary;
+ RegExp2 binary;
+ RegExp content;
+
+ switch ( type ) {
+ case sym.BAR:
+ binary = (RegExp2) this;
+ return new RegExp2(sym.BAR, binary.r1.rev(macros), binary.r2.rev(macros));
+
+ case sym.CONCAT:
+ binary = (RegExp2) this;
+ return new RegExp2(sym.CONCAT, binary.r2.rev(macros), binary.r1.rev(macros));
+
+ case sym.STAR:
+ unary = (RegExp1) this;
+ content = (RegExp) unary.content;
+ return new RegExp1(sym.STAR, content.rev(macros));
+
+ case sym.PLUS:
+ unary = (RegExp1) this;
+ content = (RegExp) unary.content;
+ return new RegExp1(sym.PLUS, content.rev(macros));
+
+ case sym.QUESTION:
+ unary = (RegExp1) this;
+ content = (RegExp) unary.content;
+ return new RegExp1(sym.QUESTION, content.rev(macros));
+
+ case sym.BANG:
+ unary = (RegExp1) this;
+ content = (RegExp) unary.content;
+ return new RegExp1(sym.BANG, content.rev(macros));
+
+ case sym.TILDE:
+ content = resolveTilde(macros);
+ return content.rev(macros);
+
+ case sym.STRING:
+ case sym.STRING_I:
+ unary = (RegExp1) this;
+ return new RegExp1(unary.type, revString((String) unary.content));
+
+ case sym.CHAR:
+ case sym.CHAR_I:
+ case sym.CCLASS:
+ case sym.CCLASSNOT:
+ unary = (RegExp1) this;
+ return new RegExp1(unary.type, unary.content);
+
+ case sym.MACROUSE:
+ unary = (RegExp1) this;
+ return macros.getDefinition((String) unary.content).rev(macros);
+ }
+
+ throw new Error("unknown regexp type "+type);
+ }
+}
Index: /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/src/JFlex/RegExp1.java
===================================================================
--- /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/src/JFlex/RegExp1.java (revision 25585)
+++ /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/src/JFlex/RegExp1.java (revision 25585)
@@ -0,0 +1,80 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * JFlex 1.4.3 *
+ * Copyright (C) 1998-2009 Gerwin Klein *
+ * All rights reserved. *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License. See the file *
+ * COPYRIGHT for more information. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License along *
+ * with this program; if not, write to the Free Software Foundation, Inc., *
+ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *
+ * *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+package JFlex;
+
+
+/**
+ * Stores a regular expression from the rules section of a JFlex specification.
+ *
+ * This class provides storage for one Object of content.
+ * It is used for all regular expressions that are constructed from one object.
+ *
+ * For instance: a* is new RegExp1(sym.STAR, new Character ('a'));
+ *
+ * @author Gerwin Klein
+ * @version JFlex 1.4.3, $Revision: 433 $, $Date: 2009-01-31 19:52:34 +1100 (Sat, 31 Jan 2009) $
+ */
+public class RegExp1 extends RegExp {
+
+ /**
+ * The child of this expression node in the syntax tree of a regular expression.
+ */
+ Object content;
+
+
+ /**
+ * Constructs a new regular expression with one child object.
+ *
+ * @param type a value from the cup generated class sym, defining the
+ * kind of this regular expression
+ *
+ * @param content the child of this expression
+ */
+ public RegExp1(int type, Object content) {
+ super(type);
+ this.content = content;
+ }
+
+
+ /**
+ * Returns a String-representation of this regular expression
+ * with the specified indentation.
+ *
+ * @param tab a String that should contain only space characters and
+ * that is inserted in front of standard String-representation
+ * pf this object.
+ */
+ public String print(String tab) {
+ if (content instanceof RegExp) {
+ return tab+"type = "+type+Out.NL+tab+"content :"+Out.NL+((RegExp)content).print(tab+" ");
+ }
+ else
+ return tab+"type = "+type+Out.NL+tab+"content :"+Out.NL+tab+" "+content;
+ }
+
+
+ /**
+ * Returns a String-representation of this regular expression
+ */
+ public String toString() {
+ return print("");
+ }
+}
Index: /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/src/JFlex/RegExp2.java
===================================================================
--- /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/src/JFlex/RegExp2.java (revision 25585)
+++ /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/src/JFlex/RegExp2.java (revision 25585)
@@ -0,0 +1,50 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * JFlex 1.4.3 *
+ * Copyright (C) 1998-2009 Gerwin Klein *
+ * All rights reserved. *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License. See the file *
+ * COPYRIGHT for more information. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License along *
+ * with this program; if not, write to the Free Software Foundation, Inc., *
+ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *
+ * *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+package JFlex;
+
+
+/**
+ * Regular expression with two children (e.g. a | b)
+ *
+ * @author Gerwin Klein
+ * @version JFlex 1.4.3, $Revision: 433 $, $Date: 2009-01-31 19:52:34 +1100 (Sat, 31 Jan 2009) $
+ */
+public class RegExp2 extends RegExp {
+
+ RegExp r1, r2;
+
+ public RegExp2(int type, RegExp r1, RegExp r2) {
+ super(type);
+ this.r1 = r1;
+ this.r2 = r2;
+ }
+
+ public String print(String tab) {
+ return tab+"type = "+type+Out.NL+tab+"child 1 :"+Out.NL+ //$NON-NLS-1$ //$NON-NLS-2$
+ r1.print(tab+" ")+Out.NL+tab+"child 2 :"+Out.NL+ //$NON-NLS-1$ //$NON-NLS-2$
+ r2.print(tab+" "); //$NON-NLS-1$
+ }
+
+ public String toString() {
+ return print(""); //$NON-NLS-1$
+ }
+}
+
Index: /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/src/JFlex/RegExps.java
===================================================================
--- /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/src/JFlex/RegExps.java (revision 25585)
+++ /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/src/JFlex/RegExps.java (revision 25585)
@@ -0,0 +1,217 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * JFlex 1.4.3 *
+ * Copyright (C) 1998-2009 Gerwin Klein *
+ * All rights reserved. *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License. See the file *
+ * COPYRIGHT for more information. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License along *
+ * with this program; if not, write to the Free Software Foundation, Inc., *
+ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *
+ * *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+package JFlex;
+
+import java.util.*;
+
+
+/**
+ * Stores all rules of the specification for later access in RegExp -> NFA
+ *
+ * @author Gerwin Klein
+ * @version JFlex 1.4.3, $Revision: 433 $, $Date: 2009-01-31 19:52:34 +1100 (Sat, 31 Jan 2009) $
+ */
+public class RegExps {
+
+ /** the spec line in which a regexp is used */
+ Vector /* of Integer */ lines;
+
+ /** the lexical states in wich the regexp is used */
+ Vector /* of Vector of Integer */ states;
+
+ /** the regexp */
+ Vector /* of RegExp */ regExps;
+
+ /** the action of a regexp */
+ Vector /* of Action */ actions;
+
+ /** flag if it is a BOL regexp */
+ Vector /* of Boolean */ BOL;
+
+ /** the lookahead expression */
+ Vector /* of RegExp */ look;
+
+ /** the forward DFA entry point of the lookahead expression */
+ Vector /* of Integer */ look_entry;
+
+ /** Count of many general lookahead expressions there are.
+ * Need 2*gen_look_count additional DFA entry points. */
+ int gen_look_count;
+
+ public RegExps() {
+ states = new Vector();
+ regExps = new Vector();
+ actions = new Vector();
+ BOL = new Vector();
+ look = new Vector();
+ lines = new Vector();
+ look_entry = new Vector();
+ }
+
+ public int insert(int line, Vector stateList, RegExp regExp, Action action,
+ Boolean isBOL, RegExp lookAhead) {
+ if (Options.DEBUG) {
+ Out.debug("Inserting regular expression with statelist :"+Out.NL+stateList); //$NON-NLS-1$
+ Out.debug("and action code :"+Out.NL+action.content+Out.NL); //$NON-NLS-1$
+ Out.debug("expression :"+Out.NL+regExp); //$NON-NLS-1$
+ }
+
+ states.addElement(stateList);
+ regExps.addElement(regExp);
+ actions.addElement(action);
+ BOL.addElement(isBOL);
+ look.addElement(lookAhead);
+ lines.addElement(new Integer(line));
+ look_entry.addElement(null);
+
+ return states.size()-1;
+ }
+
+ public int insert(Vector stateList, Action action) {
+
+ if (Options.DEBUG) {
+ Out.debug("Inserting eofrule with statelist :"+Out.NL+stateList); //$NON-NLS-1$
+ Out.debug("and action code :"+Out.NL+action.content+Out.NL); //$NON-NLS-1$
+ }
+
+ states.addElement(stateList);
+ regExps.addElement(null);
+ actions.addElement(action);
+ BOL.addElement(null);
+ look.addElement(null);
+ lines.addElement(null);
+ look_entry.addElement(null);
+
+ return states.size()-1;
+ }
+
+ public void addStates(int regNum, Vector newStates) {
+ Enumeration s = newStates.elements();
+
+ while (s.hasMoreElements())
+ ((Vector)states.elementAt(regNum)).addElement(s.nextElement());
+ }
+
+ public int getNum() {
+ return states.size();
+ }
+
+ public boolean isBOL(int num) {
+ return ((Boolean) BOL.elementAt(num)).booleanValue();
+ }
+
+ public RegExp getLookAhead(int num) {
+ return (RegExp) look.elementAt(num);
+ }
+
+ public boolean isEOF(int num) {
+ return BOL.elementAt(num) == null;
+ }
+
+ public Vector getStates(int num) {
+ return (Vector) states.elementAt(num);
+ }
+
+ public RegExp getRegExp(int num) {
+ return (RegExp) regExps.elementAt(num);
+ }
+
+ public int getLine(int num) {
+ return ((Integer) lines.elementAt(num)).intValue();
+ }
+
+ public int getLookEntry(int num) {
+ return ((Integer) look_entry.elementAt(num)).intValue();
+ }
+
+ public void checkActions() {
+ if ( actions.elementAt(actions.size()-1) == null ) {
+ Out.error(ErrorMessages.NO_LAST_ACTION);
+ throw new GeneratorException();
+ }
+ }
+
+ public Action getAction(int num) {
+ while ( num < actions.size() && actions.elementAt(num) == null )
+ num++;
+
+ return (Action) actions.elementAt(num);
+ }
+
+ public int NFASize(Macros macros) {
+ int size = 0;
+ Enumeration e = regExps.elements();
+ while (e.hasMoreElements()) {
+ RegExp r = (RegExp) e.nextElement();
+ if (r != null) size += r.size(macros);
+ }
+ e = look.elements();
+ while (e.hasMoreElements()) {
+ RegExp r = (RegExp) e.nextElement();
+ if (r != null) size += r.size(macros);
+ }
+ return size;
+ }
+
+ public void checkLookAheads() {
+ for (int i=0; i < regExps.size(); i++)
+ lookAheadCase(i);
+ }
+
+ /**
+ * Determine which case of lookahead expression regExpNum points to (if any).
+ * Set case data in corresponding action.
+ * Increment count of general lookahead expressions for entry points
+ * of the two additional DFAs.
+ * Register DFA entry point in RegExps
+ *
+ * Needs to be run before adding any regexps/rules to be able to reserve
+ * the correct amount of space of lookahead DFA entry points.
+ *
+ * @param regExpNum the number of the regexp in RegExps.
+ */
+ private void lookAheadCase(int regExpNum) {
+ if ( getLookAhead(regExpNum) != null ) {
+ RegExp r1 = getRegExp(regExpNum);
+ RegExp r2 = getLookAhead(regExpNum);
+
+ Action a = getAction(regExpNum);
+
+ int len1 = SemCheck.length(r1);
+ int len2 = SemCheck.length(r2);
+
+ if (len1 >= 0) {
+ a.setLookAction(Action.FIXED_BASE,len1);
+ }
+ else if (len2 >= 0) {
+ a.setLookAction(Action.FIXED_LOOK,len2);
+ }
+ else if (SemCheck.isFiniteChoice(r2)) {
+ a.setLookAction(Action.FINITE_CHOICE,0);
+ }
+ else {
+ a.setLookAction(Action.GENERAL_LOOK,0);
+ look_entry.setElementAt(new Integer(gen_look_count), regExpNum);
+ gen_look_count++;
+ }
+ }
+ }
+
+}
Index: /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/src/JFlex/ScannerException.java
===================================================================
--- /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/src/JFlex/ScannerException.java (revision 25585)
+++ /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/src/JFlex/ScannerException.java (revision 25585)
@@ -0,0 +1,104 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * JFlex 1.4.3 *
+ * Copyright (C) 1998-2009 Gerwin Klein *
+ * All rights reserved. *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License. See the file *
+ * COPYRIGHT for more information. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License along *
+ * with this program; if not, write to the Free Software Foundation, Inc., *
+ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *
+ * *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+package JFlex;
+
+import java.io.File;
+
+/**
+ * This Exception could be thrown while scanning the specification
+ * (e.g. unmatched input)
+ *
+ * @author Gerwin Klein
+ * @version JFlex 1.4.3, $Revision: 433 $, $Date: 2009-01-31 19:52:34 +1100 (Sat, 31 Jan 2009) $
+ */
+public class ScannerException extends RuntimeException {
+
+ public int line;
+ public int column;
+ public ErrorMessages message;
+ public File file;
+
+ private ScannerException(File file, String text, ErrorMessages message, int line, int column) {
+ super(text);
+ this.file = file;
+ this.message = message;
+ this.line = line;
+ this.column = column;
+ }
+
+
+ /**
+ * Creates a new ScannerException with a message only.
+ *
+ * @param message the code for the error description presented to the user.
+ */
+ public ScannerException(ErrorMessages message) {
+ this( null, ErrorMessages.get(message), message, -1, -1 );
+ }
+
+ /**
+ * Creates a new ScannerException for a file with a message only.
+ *
+ * @param file the file in which the error occured
+ * @param message the code for the error description presented to the user.
+ */
+ public ScannerException(File file, ErrorMessages message) {
+ this( file, ErrorMessages.get(message), message, -1, -1 );
+ }
+
+
+ /**
+ * Creates a new ScannerException with a message and line number.
+ *
+ * @param message the code for the error description presented to the user.
+ * @param line the number of the line in the specification that
+ * contains the error
+ */
+ public ScannerException(ErrorMessages message, int line) {
+ this( null, ErrorMessages.get(message), message, line, -1 );
+ }
+
+
+ /**
+ * Creates a new ScannerException for a file with a message and line number.
+ *
+ * @param message the code for the error description presented to the user.
+ * @param line the number of the line in the specification that
+ * contains the error
+ */
+ public ScannerException(File file, ErrorMessages message, int line) {
+ this( file, ErrorMessages.get(message), message, line, -1 );
+ }
+
+
+ /**
+ * Creates a new ScannerException with a message, line number and column.
+ *
+ * @param message the code for the error description presented to the user.
+ * @param line the number of the line in the specification that
+ * contains the error
+ * @param column the column where the error starts
+ */
+ public ScannerException(File file, ErrorMessages message, int line, int column) {
+ this( file, ErrorMessages.get(message), message, line, column );
+ }
+
+}
Index: /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/src/JFlex/SemCheck.java
===================================================================
--- /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/src/JFlex/SemCheck.java (revision 25585)
+++ /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/src/JFlex/SemCheck.java (revision 25585)
@@ -0,0 +1,227 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * JFlex 1.4.3 *
+ * Copyright (C) 1998-2009 Gerwin Klein *
+ * All rights reserved. *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License. See the file *
+ * COPYRIGHT for more information. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License along *
+ * with this program; if not, write to the Free Software Foundation, Inc., *
+ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *
+ * *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+package JFlex;
+
+import java.io.File;
+
+/**
+ * Performs simple semantic analysis on regular expressions.
+ *
+ * @author Gerwin Klein
+ * @version JFlex 1.4.3, $Revision: 433 $, $Date: 2009-01-31 19:52:34 +1100 (Sat, 31 Jan 2009) $
+ */
+public final class SemCheck {
+
+ // stored globally since they are used as constants in all checks
+ private static Macros macros;
+
+ /**
+ * Performs semantic analysis for all expressions.
+ *
+ * Currently checks for empty expressions only.
+ *
+ * @param rs the reg exps to be checked
+ * @param m the macro table (in expanded form)
+ * @param f the spec file containing the rules
+ */
+ public static void check(RegExps rs, Macros m, File f) {
+ macros = m;
+ int num = rs.getNum();
+ for (int i = 0; i < num; i++) {
+ RegExp r = rs.getRegExp(i);
+ RegExp l = rs.getLookAhead(i);
+ Action a = rs.getAction(i);
+
+ if (r != null && l != null && maybeEmtpy(r)) {
+ if (a == null)
+ Out.error(ErrorMessages.EMPTY_MATCH, "");
+ else
+ Out.error(f, ErrorMessages.EMPTY_MATCH, a.priority-1, -1);
+ }
+ }
+ }
+
+
+ /**
+ * Checks if the expression potentially matches the empty string.
+ *
+ */
+ public static boolean maybeEmtpy(RegExp re) {
+ RegExp2 r;
+
+ switch (re.type) {
+
+ case sym.BAR: {
+ r = (RegExp2) re;
+ return maybeEmtpy(r.r1) || maybeEmtpy(r.r2);
+ }
+
+ case sym.CONCAT: {
+ r = (RegExp2) re;
+ return maybeEmtpy(r.r1) && maybeEmtpy(r.r2);
+ }
+
+ case sym.STAR:
+ case sym.QUESTION:
+ return true;
+
+ case sym.PLUS: {
+ RegExp1 r1 = (RegExp1) re;
+ return maybeEmtpy((RegExp) r1.content);
+ }
+
+ case sym.CCLASS:
+ case sym.CCLASSNOT:
+ case sym.CHAR:
+ case sym.CHAR_I:
+ return false;
+
+ case sym.STRING:
+ case sym.STRING_I: {
+ String content = (String) ((RegExp1) re).content;
+ return content.length() == 0;
+ }
+
+ case sym.TILDE:
+ return false;
+
+ case sym.BANG: {
+ RegExp1 r1 = (RegExp1) re;
+ return !maybeEmtpy((RegExp) r1.content);
+ }
+
+ case sym.MACROUSE:
+ return maybeEmtpy(macros.getDefinition((String) ((RegExp1) re).content));
+ }
+
+ throw new Error("Unkown expression type "+re.type+" in "+re); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+
+ /**
+ * Returns length if expression has fixed length, -1 otherwise.
+ *
+ * Negation operators are treated as always variable length.
+ */
+ public static int length(RegExp re) {
+ RegExp2 r;
+
+ switch (re.type) {
+
+ case sym.BAR: {
+ r = (RegExp2) re;
+ int l1 = length(r.r1);
+ if (l1 < 0) return -1;
+ int l2 = length(r.r2);
+
+ if (l1 == l2)
+ return l1;
+ else
+ return -1;
+ }
+
+ case sym.CONCAT: {
+ r = (RegExp2) re;
+ int l1 = length(r.r1);
+ if (l1 < 0) return -1;
+ int l2 = length(r.r2);
+ if (l2 < 0) return -1;
+ return l1+l2;
+ }
+
+ case sym.STAR:
+ case sym.PLUS:
+ case sym.QUESTION:
+ return -1;
+
+ case sym.CCLASS:
+ case sym.CCLASSNOT:
+ case sym.CHAR:
+ case sym.CHAR_I:
+ return 1;
+
+ case sym.STRING:
+ case sym.STRING_I: {
+ String content = (String) ((RegExp1) re).content;
+ return content.length();
+ }
+
+ case sym.TILDE:
+ case sym.BANG:
+ // too hard to calculate at this level, use safe approx
+ return -1;
+
+ case sym.MACROUSE:
+ return length(macros.getDefinition((String) ((RegExp1) re).content));
+ }
+
+ throw new Error("Unkown expression type "+re.type+" in "+re); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+
+ /**
+ * Returns true iff the expression is a finite choice of fixed length
+ * expressions.
+ *
+ * Negation operators are treated as always variable length.
+ */
+ public static boolean isFiniteChoice(RegExp re) {
+ RegExp2 r;
+
+ switch (re.type) {
+
+ case sym.BAR: {
+ r = (RegExp2) re;
+ return isFiniteChoice(r.r1) && isFiniteChoice(r.r2);
+ }
+
+ case sym.CONCAT: {
+ r = (RegExp2) re;
+ int l1 = length(r.r1);
+ if (l1 < 0) return false;
+ int l2 = length(r.r2);
+ return l2 >= 0;
+ }
+
+ case sym.STAR:
+ case sym.PLUS:
+ case sym.QUESTION:
+ return false;
+
+ case sym.CCLASS:
+ case sym.CCLASSNOT:
+ case sym.CHAR:
+ case sym.CHAR_I:
+ return true;
+
+ case sym.STRING:
+ case sym.STRING_I: {
+ return true;
+ }
+
+ case sym.TILDE:
+ case sym.BANG:
+ return false;
+
+ case sym.MACROUSE:
+ return isFiniteChoice(macros.getDefinition((String) ((RegExp1) re).content));
+ }
+
+ throw new Error("Unkown expression type "+re.type+" in "+re); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+}
Index: /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/src/JFlex/SilentExit.java
===================================================================
--- /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/src/JFlex/SilentExit.java (revision 25585)
+++ /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/src/JFlex/SilentExit.java (revision 25585)
@@ -0,0 +1,31 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * JFlex 1.4.3 *
+ * Copyright (C) 1998-2009 Gerwin Klein *
+ * All rights reserved. *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License. See the file *
+ * COPYRIGHT for more information. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License along *
+ * with this program; if not, write to the Free Software Foundation, Inc., *
+ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *
+ * *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+package JFlex;
+
+/**
+ * Signals a silent exit (no statistics printout).
+ *
+ * @author Gerwin Klein
+ * @version $Revision: 433 $, $Date: 2009-01-31 19:52:34 +1100 (Sat, 31 Jan 2009) $
+ */
+public class SilentExit extends Exception {
+
+}
Index: /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/src/JFlex/Skeleton.java
===================================================================
--- /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/src/JFlex/Skeleton.java (revision 25585)
+++ /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/src/JFlex/Skeleton.java (revision 25585)
@@ -0,0 +1,222 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * JFlex 1.4.3 *
+ * Copyright (C) 1998-2009 Gerwin Klein *
+ * All rights reserved. *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License. See the file *
+ * COPYRIGHT for more information. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License along *
+ * with this program; if not, write to the Free Software Foundation, Inc., *
+ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *
+ * *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+package JFlex;
+
+import java.io.*;
+import java.net.URL;
+import java.util.Vector;
+
+
+/**
+ * This class stores the skeleton of generated scanners.
+ *
+ * The skeleton consists of several parts that can be emitted to
+ * a file. Usually there is a portion of generated code
+ * (produced in class Emitter) between every two parts of skeleton code.
+ *
+ * There is a static part (the skeleton code) and state based iterator
+ * part to this class. The iterator part is used to emit consecutive skeleton
+ * sections to some PrintWriter
.
+ *
+ * @see JFlex.Emitter
+ *
+ * @author Gerwin Klein
+ * @version JFlex 1.4.3, $Revision: 433 $, $Date: 2009-01-31 19:52:34 +1100 (Sat, 31 Jan 2009) $
+ */
+public class Skeleton {
+
+ /** location of default skeleton */
+ static final private String DEFAULT_LOC = "JFlex/skeleton.default"; //$NON-NLS-1$
+
+ /** expected number of sections in the skeleton file */
+ static final private int size = 21;
+
+ /** platform specific newline */
+ static final private String NL = System.getProperty("line.separator"); //$NON-NLS-1$
+
+ /** The skeleton */
+ public static String line[];
+
+ /** initialization */
+ static { readDefault(); }
+
+ // the state based, iterator part of Skeleton:
+
+ /**
+ * The current part of the skeleton (an index of nextStop[])
+ */
+ private int pos;
+
+ /**
+ * The writer to write the skeleton-parts to
+ */
+ private PrintWriter out;
+
+
+ /**
+ * Creates a new skeleton (iterator) instance.
+ *
+ * @param out the writer to write the skeleton-parts to
+ */
+ public Skeleton(PrintWriter out) {
+ this.out = out;
+ }
+
+
+ /**
+ * Emits the next part of the skeleton
+ */
+ public void emitNext() {
+ out.print( line[pos++] );
+ }
+
+
+ /**
+ * Make the skeleton private.
+ *
+ * Replaces all occurences of " public " in the skeleton with " private ".
+ */
+ public static void makePrivate() {
+ for (int i=0; i < line.length; i++) {
+ line[i] = replace(" public ", " private ", line[i]); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+ }
+
+
+ /**
+ * Reads an external skeleton file for later use with this class.
+ *
+ * @param skeletonFile the file to read (must be != null and readable)
+ */
+ public static void readSkelFile(File skeletonFile) {
+ if (skeletonFile == null)
+ throw new IllegalArgumentException("Skeleton file must not be null"); //$NON-NLS-1$
+
+ if (!skeletonFile.isFile() || !skeletonFile.canRead()) {
+ Out.error(ErrorMessages.CANNOT_READ_SKEL, skeletonFile.toString());
+ throw new GeneratorException();
+ }
+
+ Out.println(ErrorMessages.READING_SKEL, skeletonFile.toString());
+
+ try {
+ BufferedReader reader = new BufferedReader(new FileReader(skeletonFile));
+ readSkel(reader);
+ }
+ catch (IOException e) {
+ Out.error(ErrorMessages.SKEL_IO_ERROR);
+ throw new GeneratorException();
+ }
+ }
+
+
+ /**
+ * Reads an external skeleton file from a BufferedReader.
+ *
+ * @param reader the reader to read from (must be != null)
+ * @throws IOException if an IO error occurs
+ * @throws GeneratorException if the number of skeleton sections does not match
+ */
+ public static void readSkel(BufferedReader reader) throws IOException {
+ Vector lines = new Vector();
+ StringBuffer section = new StringBuffer();
+
+ String ln;
+ while ((ln = reader.readLine()) != null) {
+ if (ln.startsWith("---")) { //$NON-NLS-1$
+ lines.addElement(section.toString());
+ section.setLength(0);
+ } else {
+ section.append(ln);
+ section.append(NL);
+ }
+ }
+
+ if (section.length() > 0)
+ lines.addElement(section.toString());
+
+ if (lines.size() != size) {
+ Out.error(ErrorMessages.WRONG_SKELETON);
+ throw new GeneratorException();
+ }
+
+ line = new String[size];
+ for (int i = 0; i < size; i++)
+ line[i] = (String) lines.elementAt(i);
+ }
+
+ /**
+ * Replaces a with b in c.
+ *
+ * @param a the String to be replaced
+ * @param b the replacement
+ * @param c the String in which to replace a by b
+ * @return a String object with a replaced by b in c
+ */
+ public static String replace(String a, String b, String c) {
+ StringBuffer result = new StringBuffer(c.length());
+ int i = 0;
+ int j = c.indexOf(a);
+
+ while (j >= i) {
+ result.append(c.substring(i,j));
+ result.append(b);
+ i = j+a.length();
+ j = c.indexOf(a,i);
+ }
+
+ result.append(c.substring(i,c.length()));
+
+ return result.toString();
+ }
+
+
+ /**
+ * (Re)load the default skeleton. Looks in the current system class path.
+ */
+ public static void readDefault() {
+ ClassLoader l = Skeleton.class.getClassLoader();
+ URL url;
+
+ /* Try to load from same class loader as this class.
+ * Should work, but does not on OS/2 JDK 1.1.8 (see bug 1065521).
+ * Use system class loader in this case.
+ */
+ if (l != null) {
+ url = l.getResource(DEFAULT_LOC);
+ }
+ else {
+ url = ClassLoader.getSystemResource(DEFAULT_LOC);
+ }
+
+ if (url == null) {
+ Out.error(ErrorMessages.SKEL_IO_ERROR_DEFAULT);
+ throw new GeneratorException();
+ }
+
+ try {
+ InputStreamReader reader = new InputStreamReader(url.openStream());
+ readSkel(new BufferedReader(reader));
+ } catch (IOException e) {
+ Out.error(ErrorMessages.SKEL_IO_ERROR_DEFAULT);
+ throw new GeneratorException();
+ }
+ }
+}
Index: /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/src/JFlex/StatePairList.java
===================================================================
--- /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/src/JFlex/StatePairList.java (revision 25585)
+++ /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/src/JFlex/StatePairList.java (revision 25585)
@@ -0,0 +1,83 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * JFlex 1.4.3 *
+ * Copyright (C) 1998-2009 Gerwin Klein *
+ * All rights reserved. *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License. See the file *
+ * COPYRIGHT for more information. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License along *
+ * with this program; if not, write to the Free Software Foundation, Inc., *
+ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *
+ * *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+package JFlex;
+
+/**
+ * A list of pairs of states. Used in DFA minimization.
+ *
+ * @author Gerwin Klein
+ * @version JFlex 1.4.3, $Revision: 433 $, $Date: 2009-01-31 19:52:34 +1100 (Sat, 31 Jan 2009) $
+ */
+final public class StatePairList {
+
+ // implemented as two arrays of integers.
+ // java.util classes proved too inefficient.
+
+ int p [];
+ int q [];
+
+ int num;
+
+ public StatePairList() {
+ p = new int [8];
+ q = new int [8];
+ num = 0;
+ }
+
+ public void addPair(int i, int j) {
+ for (int x = 0; x < num; x++)
+ if (p[x] == i && q[x] == j) return;
+
+ if (num >= p.length) increaseSize(num);
+
+ p[num] = i;
+ q[num] = j;
+
+ num++;
+ }
+
+ public void markAll(StatePairList [] [] list, boolean [] [] equiv) {
+ for (int x = 0; x < num; x++) {
+ int i = p[x];
+ int j = q[x];
+
+ if (equiv[i][j]) {
+ equiv[i][j] = false;
+ if (list[i][j] != null)
+ list[i][j].markAll(list, equiv);
+ }
+ }
+ }
+
+ private void increaseSize(int length) {
+ length = Math.max(length+1, 4*p.length);
+ Out.debug("increasing length to "+length); //$NON-NLS-1$
+
+ int pn [] = new int[length];
+ int qn [] = new int[length];
+
+ System.arraycopy(p, 0, pn, 0, p.length);
+ System.arraycopy(q, 0, qn, 0, q.length);
+
+ p = pn;
+ q = qn;
+ }
+}
Index: /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/src/JFlex/StateSet.java
===================================================================
--- /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/src/JFlex/StateSet.java (revision 25585)
+++ /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/src/JFlex/StateSet.java (revision 25585)
@@ -0,0 +1,334 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * JFlex 1.4.3 *
+ * Copyright (C) 1998-2009 Gerwin Klein *
+ * All rights reserved. *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License. See the file *
+ * COPYRIGHT for more information. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License along *
+ * with this program; if not, write to the Free Software Foundation, Inc., *
+ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *
+ * *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+package JFlex;
+
+/**
+ * A set of NFA states (= integers).
+ *
+ * Very similar to java.util.BitSet, but is faster and doesn't crash
+ *
+ * @author Gerwin Klein
+ * @version JFlex 1.4.3, $Revision: 433 $, $Date: 2009-01-31 19:52:34 +1100 (Sat, 31 Jan 2009) $
+ */
+final public class StateSet {
+
+ private final boolean DEBUG = false;
+
+ public final static StateSet EMPTY = new StateSet();
+
+
+ final static int BITS = 6;
+ final static int MASK = (1<> BITS;
+ if (index >= bits.length) resize(state);
+ bits[index] |= (1L << (state & MASK));
+
+ if (DEBUG) {
+ Out.dump("StateSet.addState("+state+") end"); //$NON-NLS-1$ //$NON-NLS-2$
+ Out.dump("Set is : "+this); //$NON-NLS-1$
+ }
+ }
+
+
+ private int size2nbits (int size) {
+ return ((size >> BITS) + 1);
+ }
+
+
+ private void resize(int size) {
+ int needed = size2nbits(size);
+
+ // if (needed < bits.length) return;
+
+ long newbits[] = new long[Math.max(bits.length*4,needed)];
+ System.arraycopy(bits, 0, newbits, 0, bits.length);
+
+ bits = newbits;
+ }
+
+
+ public void clear() {
+ int l = bits.length;
+ for (int i = 0; i < l; i++) bits[i] = 0;
+ }
+
+ public boolean isElement(int state) {
+ int index = state >> BITS;
+ if (index >= bits.length) return false;
+ return (bits[index] & (1L << (state & MASK))) != 0;
+ }
+
+ /**
+ * Returns one element of the set and removes it.
+ *
+ * Precondition: the set is not empty.
+ */
+ public int getAndRemoveElement() {
+ int i = 0;
+ int o = 0;
+ long m = 1;
+
+ while (bits[i] == 0) i++;
+
+ while ( (bits[i] & m) == 0 ) {
+ m<<= 1;
+ o++;
+ }
+
+ bits[i]&= ~m;
+
+ return (i << BITS) + o;
+ }
+
+ public void remove(int state) {
+ int index = state >> BITS;
+ if (index >= bits.length) return;
+ bits[index] &= ~(1L << (state & MASK));
+ }
+
+ /**
+ * Returns the set of elements that contained are in the specified set
+ * but are not contained in this set.
+ */
+ public StateSet complement(StateSet set) {
+
+ if (set == null) return null;
+
+ StateSet result = new StateSet();
+
+ result.bits = new long[set.bits.length];
+
+ int i;
+ int m = Math.min(bits.length, set.bits.length);
+
+ for (i = 0; i < m; i++) {
+ result.bits[i] = ~bits[i] & set.bits[i];
+ }
+
+ if (bits.length < set.bits.length)
+ System.arraycopy(set.bits, m, result.bits, m, result.bits.length-m);
+
+ if (DEBUG)
+ Out.dump("Complement of "+this+Out.NL+"and "+set+Out.NL+" is :"+result); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+
+ return result;
+ }
+
+ public void add(StateSet set) {
+
+ if (DEBUG) Out.dump("StateSet.add("+set+") start"); //$NON-NLS-1$ //$NON-NLS-2$
+
+ if (set == null) return;
+
+ long tbits[];
+ long sbits[] = set.bits;
+ int sbitsl = sbits.length;
+
+ if (bits.length < sbitsl) {
+ tbits = new long[sbitsl];
+ System.arraycopy(bits, 0, tbits, 0, bits.length);
+ }
+ else {
+ tbits = this.bits;
+ }
+
+ for (int i = 0; i < sbitsl; i++) {
+ tbits[i] |= sbits[i];
+ }
+
+ this.bits = tbits;
+
+ if (DEBUG) {
+ Out.dump("StateSet.add("+set+") end"); //$NON-NLS-1$ //$NON-NLS-2$
+ Out.dump("Set is : "+this); //$NON-NLS-1$
+ }
+ }
+
+
+
+ public boolean containsSet(StateSet set) {
+
+ if (DEBUG)
+ Out.dump("StateSet.containsSet("+set+"), this="+this); //$NON-NLS-1$ //$NON-NLS-2$
+
+ int i;
+ int min = Math.min(bits.length, set.bits.length);
+
+ for (i = 0; i < min; i++)
+ if ( (bits[i] & set.bits[i]) != set.bits[i] ) return false;
+
+ for (i = min; i < set.bits.length; i++)
+ if ( set.bits[i] != 0 ) return false;
+
+ return true;
+ }
+
+
+
+ /**
+ * @throws ClassCastException if b is not a StateSet
+ * @throws NullPointerException if b is null
+ */
+ public boolean equals(Object b) {
+
+ int i = 0;
+ int l1,l2;
+ StateSet set = (StateSet) b;
+
+ if (DEBUG) Out.dump("StateSet.equals("+set+"), this="+this); //$NON-NLS-1$ //$NON-NLS-2$
+
+ l1 = bits.length;
+ l2 = set.bits.length;
+
+ if (l1 <= l2) {
+ while (i < l1) {
+ if (bits[i] != set.bits[i]) return false;
+ i++;
+ }
+
+ while (i < l2)
+ if (set.bits[i++] != 0) return false;
+ }
+ else {
+ while (i < l2) {
+ if (bits[i] != set.bits[i]) return false;
+ i++;
+ }
+
+ while (i < l1)
+ if (bits[i++] != 0) return false;
+ }
+
+ return true;
+ }
+
+ public int hashCode() {
+ long h = 1234;
+ long [] _bits = bits;
+ int i = bits.length-1;
+
+ // ignore zero high bits
+ while (i >= 0 && _bits[i] == 0) i--;
+
+ while (i >= 0)
+ h ^= _bits[i--] * i;
+
+ return (int)((h >> 32) ^ h);
+ }
+
+
+ public StateSetEnumerator states() {
+ return new StateSetEnumerator(this);
+ }
+
+
+ public boolean containsElements() {
+ for (int i = 0; i < bits.length; i++)
+ if (bits[i] != 0) return true;
+
+ return false;
+ }
+
+
+ public StateSet copy() {
+ StateSet set = new StateSet();
+ set.bits = new long[bits.length];
+ System.arraycopy(bits, 0, set.bits, 0, bits.length);
+ return set;
+ }
+
+
+ /**
+ * Copy specified StateSet into this.
+ *
+ * @param set the state set to copy.
+ */
+ public void copy(StateSet set) {
+
+ if (DEBUG)
+ Out.dump("StateSet.copy("+set+") start"); //$NON-NLS-1$ //$NON-NLS-2$
+
+ if (set == null) {
+ for (int i = 0; i < bits.length; i++) bits[i] = 0;
+ return;
+ }
+
+ if (bits.length < set.bits.length) {
+ bits = new long[set.bits.length];
+ }
+ else {
+ for (int i = set.bits.length; i < bits.length; i++) bits[i] = 0;
+ }
+
+ System.arraycopy(set.bits, 0, bits, 0, bits.length);
+
+ if (DEBUG) {
+ Out.dump("StateSet.copy("+set+") end"); //$NON-NLS-1$ //$NON-NLS-2$
+ Out.dump("Set is : "+this); //$NON-NLS-1$
+ }
+ }
+
+
+ public String toString() {
+ StateSetEnumerator set = states();
+
+ StringBuffer result = new StringBuffer("{"); //$NON-NLS-1$
+
+ if ( set.hasMoreElements() ) result.append(""+set.nextElement()); //$NON-NLS-1$
+
+ while ( set.hasMoreElements() ) {
+ int i = set.nextElement();
+ result.append( ", "+i); //$NON-NLS-1$
+ }
+
+ result.append("}"); //$NON-NLS-1$
+
+ return result.toString();
+ }
+}
Index: /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/src/JFlex/StateSetEnumerator.java
===================================================================
--- /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/src/JFlex/StateSetEnumerator.java (revision 25585)
+++ /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/src/JFlex/StateSetEnumerator.java (revision 25585)
@@ -0,0 +1,124 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * JFlex 1.4.3 *
+ * Copyright (C) 1998-2009 Gerwin Klein *
+ * All rights reserved. *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License. See the file *
+ * COPYRIGHT for more information. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License along *
+ * with this program; if not, write to the Free Software Foundation, Inc., *
+ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *
+ * *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+package JFlex;
+
+/**
+ * Enumerates the states of a StateSet.
+ *
+ * @author Gerwin Klein
+ * @version JFlex 1.4.3, $Revision: 433 $, $Date: 2009-01-31 19:52:34 +1100 (Sat, 31 Jan 2009) $
+ */
+final public class StateSetEnumerator {
+
+ private final static boolean DEBUG = false;
+
+ private int index;
+ private int offset;
+ private long mask;
+
+ private long [] bits;
+
+ /**
+ * creates a new StateSetEnumerator that is not yet associated
+ * with a StateSet. hasMoreElements() and nextElement() will
+ * throw NullPointerException when used before reset()
+ */
+ public StateSetEnumerator() {
+ }
+
+ public StateSetEnumerator(StateSet states) {
+ reset(states);
+ }
+
+ public void reset(StateSet states) {
+ bits = states.bits;
+ index = 0;
+ offset = 0;
+ mask = 1;
+ while (index < bits.length && bits[index] == 0)
+ index++;
+
+ if (index >= bits.length) return;
+
+ while (offset <= StateSet.MASK && ((bits[index] & mask) == 0)) {
+ mask<<= 1;
+ offset++;
+ }
+ }
+
+ private void advance() {
+
+ if (DEBUG) Out.dump("Advancing, at start, index = "+index+", offset = "+offset); //$NON-NLS-1$ //$NON-NLS-2$
+
+ // cache fields in local variable for faster access
+ int _index = this.index;
+ int _offset = this.offset;
+ long _mask = this.mask;
+ long [] _bits = this.bits;
+
+ long bi = _bits[_index];
+
+ do {
+ _offset++;
+ _mask<<= 1;
+ } while (_offset <= StateSet.MASK && ((bi & _mask) == 0));
+
+ if (_offset > StateSet.MASK) {
+ int length = _bits.length;
+
+ do
+ _index++;
+ while (_index < length && _bits[_index] == 0);
+
+ if (_index >= length) {
+ this.index = length; // indicates "no more elements"
+ return;
+ }
+
+ _offset = 0;
+ _mask = 1;
+ bi = _bits[_index];
+
+ // terminates, because bi != 0
+ while ((bi & _mask) == 0) {
+ _mask<<= 1;
+ _offset++;
+ }
+ }
+
+ // write back cached values
+ this.index = _index;
+ this.mask = _mask;
+ this.offset = _offset;
+ }
+
+ public boolean hasMoreElements() {
+ if (DEBUG) Out.dump("hasMoreElements, index = "+index+", offset = "+offset); //$NON-NLS-1$ //$NON-NLS-2$
+ return index < bits.length;
+ }
+
+ public int nextElement() {
+ if (DEBUG) Out.dump("nextElement, index = "+index+", offset = "+offset); //$NON-NLS-1$ //$NON-NLS-2$
+ int x = (index << StateSet.BITS) + offset;
+ advance();
+ return x;
+ }
+
+}
Index: /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/src/JFlex/StdOutWriter.java
===================================================================
--- /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/src/JFlex/StdOutWriter.java (revision 25585)
+++ /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/src/JFlex/StdOutWriter.java (revision 25585)
@@ -0,0 +1,113 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * JFlex 1.4.3 *
+ * Copyright (C) 1998-2009 Gerwin Klein *
+ * All rights reserved. *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License. See the file *
+ * COPYRIGHT for more information. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License along *
+ * with this program; if not, write to the Free Software Foundation, Inc., *
+ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *
+ * *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+package JFlex;
+
+
+import java.io.*;
+import java.awt.TextArea;
+
+
+/**
+ * Convenience class for JFlex stdout, redirects output to a TextArea
+ * if in GUI mode.
+ *
+ * @author Gerwin Klein
+ * @version JFlex 1.4.3, $Revision: 433 $, $Date: 2009-01-31 19:52:34 +1100 (Sat, 31 Jan 2009) $
+ */
+public final class StdOutWriter extends PrintWriter {
+
+ /** text area to write to if in gui mode, gui mode = (text != null) */
+ private TextArea text;
+
+ /**
+ * approximation of the current column in the text area
+ * for auto wrapping at wrap
characters
+ **/
+ private int col;
+
+ /** auto wrap lines in gui mode at this value */
+ private final static int wrap = 78;
+
+ /** A StdOutWriter, attached to System.out, no gui mode */
+ public StdOutWriter() {
+ super(System.out,true);
+ }
+
+ /** A StdOutWrite, attached to the specified output stream, no gui mode */
+ public StdOutWriter(OutputStream out) {
+ super(out,true);
+ }
+
+ /**
+ * Set the TextArea to write text to. Will continue
+ * to write to System.out if text is null
.
+ *
+ * @param text the TextArea to write to
+ */
+ public void setGUIMode(TextArea text) {
+ this.text = text;
+ }
+
+ /** Write a single character. */
+ public void write(int c) {
+ if (text != null) {
+ text.append(String.valueOf((char) c));
+ if (++col > wrap) println();
+ }
+ else
+ super.write(c);
+ }
+
+ /** Write a portion of an array of characters. */
+ public void write(char buf[], int off, int len) {
+ if (text != null) {
+ text.append(new String(buf,off,len));
+ if ((col+=len) > wrap) println();
+ }
+ else
+ super.write(buf, off, len);
+ }
+
+ /** Write a portion of a string. */
+ public void write(String s, int off, int len) {
+ if (text != null) {
+ text.append(s.substring(off,off+len));
+ if ((col+=len) > wrap) println();
+ }
+ else {
+ super.write(s,off,len);
+ flush();
+ }
+ }
+
+ /**
+ * Begin a new line. Which actual character/s is/are written
+ * depends on the runtime platform.
+ */
+ public void println() {
+ if (text != null) {
+ text.append(Out.NL);
+ col = 0;
+ }
+ else
+ super.println();
+ }
+}
Index: /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/src/JFlex/Timer.java
===================================================================
--- /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/src/JFlex/Timer.java (revision 25585)
+++ /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/src/JFlex/Timer.java (revision 25585)
@@ -0,0 +1,110 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * JFlex 1.4.3 *
+ * Copyright (C) 1998-2009 Gerwin Klein *
+ * All rights reserved. *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License. See the file *
+ * COPYRIGHT for more information. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License along *
+ * with this program; if not, write to the Free Software Foundation, Inc., *
+ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *
+ * *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+package JFlex;
+
+/**
+ * Very simple timer for code generation time statistics.
+ *
+ * Not very exact, measures user time, not processor time.
+ *
+ * @author Gerwin Klein
+ * @version JFlex 1.4.3, $Revision: 433 $, $Date: 2009-01-31 19:52:34 +1100 (Sat, 31 Jan 2009) $
+ */
+public class Timer {
+
+ /* the timer stores start and stop time from currentTimeMillis() */
+ private long startTime, stopTime;
+
+ /* flag if the timer is running (if stop time is valid) */
+ private boolean running;
+
+
+ /**
+ * Construct a new timer that starts immediatly.
+ */
+ public Timer() {
+ startTime = System.currentTimeMillis();
+ running = true;
+ }
+
+
+ /**
+ * Start the timer. If it is already running, the old start
+ * time is lost.
+ */
+ public void start() {
+ startTime = System.currentTimeMillis();
+ running = true;
+ }
+
+
+ /**
+ * Stop the timer.
+ */
+ public void stop() {
+ stopTime = System.currentTimeMillis();
+ running = false;
+ }
+
+
+ /**
+ * Return the number of milliseconds the timer has been running.
+ *
+ * (up till now, if it still runs, up to the stop time if it has been stopped)
+ */
+ public long diff() {
+ if (running)
+ return System.currentTimeMillis()-startTime;
+ else
+ return stopTime-startTime;
+ }
+
+
+ /**
+ * Return a string representation of the timer.
+ *
+ * @return a string displaying the diff-time in readable format (h m s ms)
+ *
+ * @see Timer#diff
+ */
+ public String toString() {
+ long diff = diff();
+
+ long millis = diff%1000;
+ long secs = (diff/1000)%60;
+ long mins = (diff/(1000*60))%60;
+ long hs = (diff/(1000*3600))%24;
+ long days = diff/(1000*3600*24);
+
+ if (days > 0)
+ return days+"d "+hs+"h "+mins+"m "+secs+"s "+millis+"ms";
+
+ if (hs > 0)
+ return hs+"h "+mins+"m "+secs+"s "+millis+"ms";
+
+ if (mins > 0)
+ return mins+"m "+secs+"s "+millis+"ms";
+
+ if (secs > 0)
+ return secs+"s "+millis+"ms";
+
+ return millis+"ms";
+ }
+}
Index: /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/src/JFlex/anttask/JFlexTask.java
===================================================================
--- /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/src/JFlex/anttask/JFlexTask.java (revision 25585)
+++ /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/src/JFlex/anttask/JFlexTask.java (revision 25585)
@@ -0,0 +1,262 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * JFlex Anttask *
+ * Copyright (C) 2001 Rafal Mantiuk *
+ * Copyright (C) 2003 changes by Gerwin Klein *
+ * All rights reserved. *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License. See the file *
+ * COPYRIGHT for more information. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License along *
+ * with this program; if not, write to the Free Software Foundation, Inc., *
+ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *
+ * *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+package JFlex.anttask;
+
+import org.apache.tools.ant.Task;
+import org.apache.tools.ant.BuildException;
+
+import JFlex.Main;
+import JFlex.Options;
+
+import java.io.*;
+
+/**
+ * JFlex task class
+ *
+ * @author Rafal Mantiuk
+ * @version JFlex 1.4.3, $Revision: 433 $, $Date: 2009-01-31 19:52:34 +1100 (Sat, 31 Jan 2009) $
+ */
+public class JFlexTask extends Task {
+ private File inputFile;
+
+ // found out by looking into .flex file
+ private String className = null;
+ private String packageName = null;
+
+ /** for javac-like dest dir behaviour */
+ private File destinationDir;
+
+ /** the actual output directory (outputDir = destinationDir + package)) */
+ private File outputDir = null;
+
+ public JFlexTask() {
+ // ant default is different from the rest of JFlex
+ setVerbose(false);
+ Options.progress = false;
+ }
+
+ public void execute() throws BuildException {
+ try {
+ if (inputFile == null)
+ throw new BuildException("Input file needed. Use ");
+
+ if (!inputFile.canRead())
+ throw new BuildException("Cannot read input file "+inputFile);
+
+ try {
+ findPackageAndClass();
+ normalizeOutdir();
+ File destFile = new File(outputDir, className + ".java");
+
+ if (inputFile.lastModified() > destFile.lastModified()) {
+ Main.generate(inputFile);
+ if (!Options.verbose)
+ System.out.println("Generated: " + destFile.getName());
+ }
+ } catch (IOException e1) {
+ throw new BuildException("IOException: " + e1.toString());
+ }
+ } catch (JFlex.GeneratorException e) {
+ throw new BuildException("JFlex: generation failed!");
+ }
+ }
+
+ /**
+ * Peek into .flex file to get package and class name
+ *
+ * @throws IOException if there is a problem reading the .flex file
+ */
+ public void findPackageAndClass() throws IOException {
+ // find name of the package and class in jflex source file
+ packageName = null;
+ className = null;
+
+ LineNumberReader reader = new LineNumberReader(new FileReader(inputFile));
+
+ while (className == null || packageName == null) {
+ String line = reader.readLine();
+ if (line == null) break;
+
+ if (packageName == null) {
+ int index = line.indexOf("package");
+ if (index >= 0) {
+ index += 7;
+
+ int end = line.indexOf(';', index);
+ if (end >= index) {
+ packageName = line.substring(index, end);
+ packageName = packageName.trim();
+ }
+ }
+ }
+
+ if (className == null) {
+ int index = line.indexOf("%class");
+ if (index >= 0) {
+ index += 6;
+
+ className = line.substring(index);
+ className = className.trim();
+ }
+ }
+ }
+
+ // package name may be null, but class name not
+ if (className == null) className = "Yylex";
+ }
+
+ /**
+ * Sets the actual output directory if not already set.
+ *
+ * Uses javac logic to determine output dir = dest dir + package name
+ * If not destdir has been set, output dir = parent of input file
+ *
+ * Assumes that package name is already set.
+ */
+ public void normalizeOutdir() {
+ if (outputDir != null) return;
+
+ // find out what the destination directory is. Append packageName to dest dir.
+ File destDir;
+
+ // this is not the default the jflex logic, but javac-like
+ if (destinationDir != null) {
+ if (packageName == null) {
+ destDir = destinationDir;
+ }
+ else {
+ String path = packageName.replace('.', File.separatorChar);
+ destDir = new File(destinationDir,path);
+ }
+ } else { //save parser to the same dir as .flex
+ destDir = new File(inputFile.getParent());
+ }
+
+ setOutdir(destDir);
+ }
+
+ /**
+ * @return package name of input file
+ *
+ * @see JFlexTask.findPackageAndClass
+ */
+ public String getPackage() {
+ return packageName;
+ }
+
+ /**
+ * @return class name of input file
+ *
+ * @see JFlexTask.findPackageAndClass
+ */
+ public String getClassName() {
+ return className;
+ }
+
+ public void setDestdir(File destinationDir) {
+ this.destinationDir = destinationDir;
+ }
+
+ public void setOutdir(File outDir) {
+ this.outputDir = outDir;
+ Options.setDir(outputDir);
+ }
+
+ public void setFile(File file) {
+ this.inputFile = file;
+ }
+
+ public void setGenerateDot(boolean genDot) {
+ setDot(genDot);
+ }
+
+ public void setTimeStatistics(boolean displayTime) {
+ Options.time = displayTime;
+ }
+
+ public void setTime(boolean displayTime) {
+ setTimeStatistics(displayTime);
+ }
+
+ public void setVerbose(boolean verbose) {
+ Options.verbose = verbose;
+ }
+
+ public void setSkeleton(File skeleton) {
+ Options.setSkeleton(skeleton);
+ }
+
+ public void setSkel(File skeleton) {
+ setSkeleton(skeleton);
+ }
+
+ public void setSkipMinimization(boolean skipMin) {
+ setNomin(skipMin);
+ }
+
+ public void setNomin(boolean b) {
+ Options.no_minimize = b;
+ }
+
+ public void setNobak(boolean b) {
+ Options.no_backup = b;
+ }
+
+ public void setSwitch(boolean b) {
+ if (b) {
+ Options.gen_method = Options.SWITCH;
+ }
+ else {
+ Options.gen_method = Options.PACK;
+ }
+ }
+
+ public void setTable(boolean b) {
+ if (b) {
+ Options.gen_method = Options.TABLE;
+ }
+ else {
+ Options.gen_method = Options.PACK;
+ }
+ }
+
+ public void setPack(boolean b) {
+ if (b) {
+ Options.gen_method = Options.PACK;
+ }
+ else {
+ Options.gen_method = Options.SWITCH;
+ }
+ }
+
+ public void setDot(boolean b) {
+ Options.dot = b;
+ }
+
+ public void setDump(boolean b) {
+ Options.dump = b;
+ }
+
+ public void setJLex(boolean b) {
+ Options.jlex = b;
+ }
+}
Index: /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/src/JFlex/gui/GeneratorThread.java
===================================================================
--- /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/src/JFlex/gui/GeneratorThread.java (revision 25585)
+++ /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/src/JFlex/gui/GeneratorThread.java (revision 25585)
@@ -0,0 +1,93 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * JFlex 1.4.3 *
+ * Copyright (C) 1998-2009 Gerwin Klein *
+ * All rights reserved. *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License. See the file *
+ * COPYRIGHT for more information. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License along *
+ * with this program; if not, write to the Free Software Foundation, Inc., *
+ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *
+ * *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+package JFlex.gui;
+
+import JFlex.*;
+
+import java.io.File;
+
+
+/**
+ * Low priority thread for code generation (low priority
+ * that gui has time for screen updates)
+ *
+ * @author Gerwin Klein
+ * @version JFlex 1.4.3, $Revision: 433 $, $Date: 2009-01-31 19:52:34 +1100 (Sat, 31 Jan 2009) $
+ */
+public class GeneratorThread extends Thread {
+
+ /** there must be at most one instance of this Thread running */
+ private static volatile boolean running = false;
+
+ /** input file setting from GUI */
+ String inputFile;
+
+ /** output directory */
+ String outputDir;
+
+ /** main UI component, likes to be notified when generator finishes */
+ MainFrame parent;
+
+ /**
+ * Create a new GeneratorThread, but do not run it yet.
+ *
+ * @param parent the frame, main UI component
+ * @param inputFile input file from UI settings
+ * @param messages where generator messages should appear
+ * @param outputDir output directory from UI settings
+ */
+ public GeneratorThread(MainFrame parent, String inputFile,
+ String outputDir) {
+ this.parent = parent;
+ this.inputFile = inputFile;
+ this.outputDir = outputDir;
+ }
+
+
+ /**
+ * Run the generator thread. Only one instance of it can run at any time.
+ */
+ public void run() {
+ if (running) {
+ Out.error(ErrorMessages.ALREADY_RUNNING);
+ parent.generationFinished(false);
+ }
+ else {
+ running = true;
+ setPriority(MIN_PRIORITY);
+ try {
+ if (!outputDir.equals("")) {
+ Options.setDir(outputDir);
+ }
+ Main.generate(new File(inputFile));
+ Out.statistics();
+ parent.generationFinished(true);
+ }
+ catch (GeneratorException e) {
+ Out.statistics();
+ parent.generationFinished(false);
+ }
+ finally {
+ running = false;
+ }
+ }
+ }
+}
Index: /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/src/JFlex/gui/GridPanel.java
===================================================================
--- /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/src/JFlex/gui/GridPanel.java (revision 25585)
+++ /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/src/JFlex/gui/GridPanel.java (revision 25585)
@@ -0,0 +1,161 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * JFlex 1.4.3 *
+ * Copyright (C) 1998-2009 Gerwin Klein *
+ * All rights reserved. *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License. See the file *
+ * COPYRIGHT for more information. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License along *
+ * with this program; if not, write to the Free Software Foundation, Inc., *
+ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *
+ * *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+package JFlex.gui;
+
+import java.awt.*;
+import java.util.*;
+
+/**
+ * Grid layout manager like GridLayout but with predefinable
+ * grid size.
+ *
+ * @author Gerwin Klein
+ * @version JFlex 1.4.3, $Revision: 433 $, $Date: 2009-01-31 19:52:34 +1100 (Sat, 31 Jan 2009) $
+ */
+public class GridPanel extends Panel implements Handles {
+
+ private int cols;
+ private int rows;
+
+ private int hgap;
+ private int vgap;
+
+ private Vector constraints = new Vector();
+ private Insets insets = new Insets(0,0,0,0);
+
+ public GridPanel(int cols, int rows) {
+ this(cols, rows, 0, 0);
+ }
+
+ public GridPanel(int cols, int rows, int hgap, int vgap) {
+ this.cols = cols;
+ this.rows = rows;
+ this.hgap = hgap;
+ this.vgap = vgap;
+ }
+
+ public void doLayout() {
+ Dimension size = getSize();
+ size.height -= insets.top+insets.bottom;
+ size.width -= insets.left+insets.right;
+
+ float cellWidth = size.width/cols;
+ float cellHeight = size.height/rows;
+
+ for (int i = 0; i < constraints.size(); i++) {
+ GridPanelConstraint c = (GridPanelConstraint) constraints.elementAt(i);
+
+ float x = cellWidth * c.x + insets.left + hgap/2;
+ float y = cellHeight * c.y + insets.right + vgap/2;
+
+ float width, height;
+
+ if (c.handle == FILL) {
+ width = (cellWidth-hgap) * c.width;
+ height = (cellHeight-vgap) * c.height;
+ }
+ else {
+ Dimension d = c.component.getPreferredSize();
+ width = d.width;
+ height = d.height;
+ }
+
+ switch (c.handle) {
+ case TOP_CENTER:
+ x+= (cellWidth+width)/2;
+ break;
+ case TOP_RIGHT:
+ x+= cellWidth-width;
+ break;
+ case CENTER_LEFT:
+ y+= (cellHeight+height)/2;
+ break;
+ case CENTER:
+ x+= (cellWidth+width)/2;
+ y+= (cellHeight+height)/2;
+ break;
+ case CENTER_RIGHT:
+ y+= (cellHeight+height)/2;
+ x+= cellWidth-width;
+ break;
+ case BOTTOM:
+ y+= cellHeight-height;
+ break;
+ case BOTTOM_CENTER:
+ x+= (cellWidth+width)/2;
+ y+= cellHeight-height;
+ break;
+ case BOTTOM_RIGHT:
+ y+= cellHeight-height;
+ x+= cellWidth-width;
+ break;
+ }
+
+ c.component.setBounds(new Rectangle((int)x, (int)y, (int)width, (int)height));
+ }
+ }
+
+ public Dimension getPreferredSize() {
+ float dy = 0;
+ float dx = 0;
+
+ for (int i = 0; i < constraints.size(); i++) {
+ GridPanelConstraint c = (GridPanelConstraint) constraints.elementAt(i);
+
+ Dimension d = c.component.getPreferredSize();
+
+ dx = Math.max(dx, d.width/c.width);
+ dy = Math.max(dy, d.height/c.height);
+ }
+
+ dx+= hgap;
+ dy+= vgap;
+
+ dx*= cols;
+ dy*= rows;
+
+ dx+= insets.left+insets.right;
+ dy+= insets.top+insets.bottom;
+
+ return new Dimension((int)dx,(int)dy);
+ }
+
+ public void setInsets(Insets insets) {
+ this.insets = insets;
+ }
+
+ public void add(int x, int y, Component c) {
+ add(x,y,1,1,FILL,c);
+ }
+
+ public void add(int x, int y, int handle, Component c) {
+ add(x,y,1,1,handle,c);
+ }
+
+ public void add(int x, int y, int dx, int dy, Component c) {
+ add(x,y,dx,dy,FILL,c);
+ }
+
+ public void add(int x, int y, int dx, int dy, int handle, Component c) {
+ super.add(c);
+ constraints.addElement(new GridPanelConstraint(x,y,dx,dy,handle,c));
+ }
+}
Index: /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/src/JFlex/gui/GridPanelConstraint.java
===================================================================
--- /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/src/JFlex/gui/GridPanelConstraint.java (revision 25585)
+++ /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/src/JFlex/gui/GridPanelConstraint.java (revision 25585)
@@ -0,0 +1,44 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * JFlex 1.4.3 *
+ * Copyright (C) 1998-2009 Gerwin Klein *
+ * All rights reserved. *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License. See the file *
+ * COPYRIGHT for more information. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License along *
+ * with this program; if not, write to the Free Software Foundation, Inc., *
+ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *
+ * *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+package JFlex.gui;
+
+import java.awt.Component;
+
+/**
+ * Constraints for layout elements of GridLayout
+ *
+ * @author Gerwin Klein
+ * @version JFlex 1.4.3, $Revision: 433 $, $Date: 2009-01-31 19:52:34 +1100 (Sat, 31 Jan 2009) $
+ */
+public class GridPanelConstraint {
+
+ int x, y, width, height, handle;
+ Component component;
+
+ public GridPanelConstraint(int x, int y, int width, int height,
+ int handle, Component component) {
+ this.x = x;
+ this.y = y;
+ this.width = width;
+ this.height = height;
+ this.handle = handle;
+ this.component = component;
+ }
+}
Index: /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/src/JFlex/gui/Handles.java
===================================================================
--- /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/src/JFlex/gui/Handles.java (revision 25585)
+++ /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/src/JFlex/gui/Handles.java (revision 25585)
@@ -0,0 +1,49 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * JFlex 1.4.3 *
+ * Copyright (C) 1998-2009 Gerwin Klein *
+ * All rights reserved. *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License. See the file *
+ * COPYRIGHT for more information. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License along *
+ * with this program; if not, write to the Free Software Foundation, Inc., *
+ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *
+ * *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+package JFlex.gui;
+
+/**
+ * Constants used for GridLayout
+ *
+ * @author Gerwin Klein
+ * @version JFlex 1.4.3, $Revision: 433 $, $Date: 2009-01-31 19:52:34 +1100 (Sat, 31 Jan 2009) $
+ */
+public interface Handles {
+
+ int FILL = 0;
+
+ int TOP = 1;
+ int TOP_LEFT = TOP;
+ int TOP_CENTER = 2;
+ int TOP_RIGHT = 3;
+
+ int CENTER_LEFT = 4;
+ int CENTER = 5;
+ int CENTER_CENTER = CENTER;
+ int CENTER_RIGHT = 6;
+
+ int BOTTOM = 7;
+ int BOTTOM_LEFT = BOTTOM;
+ int BOTTOM_CENTER = 8;
+ int BOTTOM_RIGHT = 9;
+
+}
+
Index: /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/src/JFlex/gui/MainFrame.java
===================================================================
--- /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/src/JFlex/gui/MainFrame.java (revision 25585)
+++ /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/src/JFlex/gui/MainFrame.java (revision 25585)
@@ -0,0 +1,275 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * JFlex 1.4.3 *
+ * Copyright (C) 1998-2009 Gerwin Klein *
+ * All rights reserved. *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License. See the file *
+ * COPYRIGHT for more information. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License along *
+ * with this program; if not, write to the Free Software Foundation, Inc., *
+ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *
+ * *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+package JFlex.gui;
+
+import JFlex.Main;
+import JFlex.Out;
+
+import java.io.File;
+import java.awt.*;
+import java.awt.event.*;
+
+/**
+ * JFlex main application frame (GUI mode only)
+ *
+ * @author Gerwin Klein
+ * @version JFlex 1.4.3, $Revision: 433 $, $Date: 2009-01-31 19:52:34 +1100 (Sat, 31 Jan 2009) $
+ */
+final public class MainFrame extends Frame implements Handles {
+
+ private volatile boolean choosing;
+
+ private String fileName = "";
+ private String dirName = "";
+
+ private Button quit;
+ private Button options;
+ private Button generate;
+ private Button stop;
+ private Button specChoose;
+ private Button dirChoose;
+
+ private TextField spec;
+ private TextField dir;
+
+ private TextArea messages;
+
+ private GeneratorThread thread;
+
+ private OptionsDialog dialog;
+
+
+ public MainFrame() {
+ super("JFlex "+Main.version);
+ buildContent();
+
+ addWindowListener( new WindowAdapter() {
+ public void windowClosing(WindowEvent e) {
+ quit();
+ }
+ });
+
+ pack();
+ show();
+ }
+
+
+ private void buildContent() {
+ setBackground(SystemColor.control);
+
+ generate = new Button("Generate");
+ quit = new Button("Quit");
+ options = new Button("Options");
+ stop = new Button("Stop");
+ dirChoose = new Button("Browse");
+ dir = new TextField(10);
+ specChoose = new Button("Browse");
+ spec = new TextField(10);
+ messages = new TextArea(10,80);
+
+ messages.setEditable(false);
+ Font font = messages.getFont();
+ if (font != null)
+ messages.setFont(new Font("Monospaced", font.getStyle(), font.getSize()));
+ else
+ messages.setFont(new Font("Monospaced", Font.PLAIN, 12));
+
+ Out.setGUIMode(messages);
+
+ generate.addActionListener( new ActionListener() {
+ public void actionPerformed(ActionEvent e) {
+ generate();
+ }
+ } );
+
+ options.addActionListener( new ActionListener() {
+ public void actionPerformed(ActionEvent e) {
+ showOptions();
+ }
+ } );
+
+ quit.addActionListener( new ActionListener() {
+ public void actionPerformed(ActionEvent e) {
+ quit();
+ }
+ } );
+
+ stop.addActionListener( new ActionListener() {
+ public void actionPerformed(ActionEvent e) {
+ stop();
+ }
+ } );
+
+ specChoose.addActionListener( new ActionListener() {
+ public void actionPerformed(ActionEvent e) {
+ specChoose();
+ }
+ } );
+
+ dirChoose.addActionListener( new ActionListener() {
+ public void actionPerformed(ActionEvent e) {
+ dirChoose();
+ }
+ } );
+
+ spec.addActionListener( new ActionListener() {
+ public void actionPerformed(ActionEvent e) {
+ fileName = spec.getText();
+ generate();
+ }
+ } );
+
+ spec.addTextListener( new TextListener() {
+ public void textValueChanged(TextEvent e) {
+ fileName = spec.getText();
+ }
+ } );
+
+ dir.addActionListener( new ActionListener() {
+ public void actionPerformed(ActionEvent e) {
+ dirName = dir.getText();
+ generate();
+ }
+ } );
+
+ dir.addTextListener( new TextListener() {
+ public void textValueChanged(TextEvent e) {
+ dirName = dir.getText();
+ }
+ } );
+
+ GridPanel north = new GridPanel(5,4,10,10);
+ north.setInsets( new Insets(10,5,5,10) );
+
+ north.add( 4,0, quit);
+ north.add( 4,1, generate);
+ north.add( 4,2, options);
+ north.add( 4,3, stop);
+
+ north.add( 0,0, BOTTOM, new Label("Lexical specification:"));
+ north.add( 0,1, 2,1, spec);
+ north.add( 2,1, specChoose);
+
+ north.add( 0,2, BOTTOM, new Label("Output directory:"));
+ north.add( 0,3, 2,1, dir);
+ north.add( 2,3, dirChoose);
+
+ Panel center = new Panel(new BorderLayout());
+ center.add("North", new Label("Messages:"));
+ center.add("Center", messages);
+
+ add("North", north);
+ add("Center", center);
+
+ setEnabledAll(false);
+ }
+
+ protected void showOptions() {
+ if (dialog == null) {
+ dialog = new OptionsDialog(this);
+ }
+ dialog.show();
+ }
+
+
+ public Dimension getPreferredSize() {
+ Dimension d = super.getPreferredSize();
+ d.width = messages.getPreferredSize().width;
+ return d;
+ }
+
+ private void setEnabledAll(boolean generating) {
+ stop.setEnabled( generating );
+ quit.setEnabled( !generating );
+ generate.setEnabled( !generating );
+ dirChoose.setEnabled( !generating );
+ dir.setEnabled( !generating );
+ specChoose.setEnabled( !generating );
+ spec.setEnabled( !generating );
+ }
+
+ private void generate() {
+ // workaround for a weird AWT bug
+ if (choosing) return;
+
+ setEnabledAll(true);
+
+ thread = new GeneratorThread(this, fileName, dirName);
+ thread.start();
+ }
+
+ public void generationFinished(boolean success) {
+ setEnabledAll(false);
+
+ if (success)
+ messages.append(Out.NL+"Generation finished successfully."+Out.NL);
+ else
+ messages.append(Out.NL+"Generation aborted."+Out.NL);
+ }
+
+ private void stop() {
+ if (thread != null) {
+ /* stop ok here despite deprecation (?)
+ I don't know any good way to abort generation without changing the
+ generator code */
+ thread.stop();
+ thread = null;
+ }
+ generationFinished(false);
+ }
+
+ private void quit() {
+ setVisible(false);
+ System.exit(0);
+ }
+
+ private void dirChoose() {
+ choosing = true;
+
+ FileDialog d = new FileDialog(this, "Choose directory", FileDialog.LOAD);
+
+ d.show();
+
+ if (d.getDirectory() != null) {
+ dir.setText( (new File(d.getDirectory())).getAbsolutePath() );
+ }
+
+ choosing = false;
+ }
+
+ private void specChoose() {
+ choosing = true;
+
+ FileDialog d = new FileDialog(this, "Choose file", FileDialog.LOAD);
+
+ d.setFile("*.flex");
+ d.show();
+
+ if (d.getFile() != null) {
+ fileName = d.getDirectory()+d.getFile();
+ dir.setText(d.getDirectory());
+ spec.setText(fileName);
+ }
+
+ choosing = false;
+ }
+
+}
Index: /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/src/JFlex/gui/OptionsDialog.java
===================================================================
--- /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/src/JFlex/gui/OptionsDialog.java (revision 25585)
+++ /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/src/JFlex/gui/OptionsDialog.java (revision 25585)
@@ -0,0 +1,259 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * JFlex 1.4.3 *
+ * Copyright (C) 1998-2009 Gerwin Klein *
+ * All rights reserved. *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License. See the file *
+ * COPYRIGHT for more information. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License along *
+ * with this program; if not, write to the Free Software Foundation, Inc., *
+ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *
+ * *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+package JFlex.gui;
+
+import java.awt.*;
+import java.awt.event.*;
+
+import java.io.File;
+
+import JFlex.GeneratorException;
+import JFlex.Options;
+import JFlex.Skeleton;
+
+/**
+ * A dialog for setting JFlex options
+ *
+ * @author Gerwin Klein
+ * @version $Revision: 433 $, $Date: 2009-01-31 19:52:34 +1100 (Sat, 31 Jan 2009) $
+ */
+public class OptionsDialog extends Dialog {
+
+ private Frame owner;
+
+ private Button skelBrowse;
+ private TextField skelFile;
+
+ private Button ok;
+ private Button defaults;
+
+ private Checkbox dump;
+ private Checkbox verbose;
+ private Checkbox jlex;
+ private Checkbox no_minimize;
+ private Checkbox no_backup;
+ private Checkbox time;
+ private Checkbox dot;
+
+ private Checkbox tableG;
+ private Checkbox switchG;
+ private Checkbox packG;
+
+
+ /**
+ * Create a new options dialog
+ *
+ * @param owner
+ */
+ public OptionsDialog(Frame owner) {
+ super(owner, "Options");
+
+ this.owner = owner;
+
+ setup();
+ pack();
+
+ addWindowListener( new WindowAdapter() {
+ public void windowClosing(WindowEvent e) {
+ close();
+ }
+ });
+ }
+
+ public void setup() {
+ // create components
+ ok = new Button("Ok");
+ defaults = new Button("Defaults");
+ skelBrowse = new Button(" Browse");
+ skelFile = new TextField();
+ skelFile.setEditable(false);
+ dump = new Checkbox(" dump");
+ verbose = new Checkbox(" verbose");
+
+ jlex = new Checkbox(" JLex compatibility");
+ no_minimize = new Checkbox(" skip minimization");
+ no_backup = new Checkbox(" no backup file");
+ time = new Checkbox(" time statistics");
+ dot = new Checkbox(" dot graph files");
+
+ CheckboxGroup codeG = new CheckboxGroup();
+ tableG = new Checkbox(" table",Options.gen_method == Options.TABLE, codeG);
+ switchG = new Checkbox(" switch",Options.gen_method == Options.SWITCH, codeG);
+ packG = new Checkbox(" pack",Options.gen_method == Options.PACK, codeG);
+
+ // setup interaction
+ ok.addActionListener( new ActionListener() {
+ public void actionPerformed(ActionEvent e) {
+ close();
+ }
+ } );
+
+ defaults.addActionListener( new ActionListener() {
+ public void actionPerformed(ActionEvent e) {
+ setDefaults();
+ }
+ } );
+
+ skelBrowse.addActionListener( new ActionListener() {
+ public void actionPerformed(ActionEvent e) {
+ skelBrowse();
+ }
+ } );
+
+ tableG.addItemListener( new ItemListener() {
+ public void itemStateChanged(ItemEvent e) {
+ setGenMethod();
+ }
+ } );
+
+ verbose.addItemListener( new ItemListener() {
+ public void itemStateChanged(ItemEvent e) {
+ Options.verbose = verbose.getState();
+ }
+ } );
+
+ dump.addItemListener( new ItemListener() {
+ public void itemStateChanged(ItemEvent e) {
+ Options.dump = dump.getState();
+ }
+ } );
+
+ jlex.addItemListener( new ItemListener() {
+ public void itemStateChanged(ItemEvent e) {
+ Options.jlex = jlex.getState();
+ }
+ } );
+
+ no_minimize.addItemListener( new ItemListener() {
+ public void itemStateChanged(ItemEvent e) {
+ Options.no_minimize = no_minimize.getState();
+ }
+ } );
+
+ no_backup.addItemListener( new ItemListener() {
+ public void itemStateChanged(ItemEvent e) {
+ Options.no_backup = no_backup.getState();
+ }
+ } );
+
+ dot.addItemListener( new ItemListener() {
+ public void itemStateChanged(ItemEvent e) {
+ Options.dot = dot.getState();
+ }
+ } );
+
+ time.addItemListener( new ItemListener() {
+ public void itemStateChanged(ItemEvent e) {
+ Options.time = time.getState();
+ }
+ } );
+
+ // setup layout
+ GridPanel panel = new GridPanel(4,7,10,10);
+ panel.setInsets( new Insets(10,5,5,10) );
+
+ panel.add(3,0,ok);
+ panel.add(3,1,defaults);
+
+ panel.add(0,0,2,1,Handles.BOTTOM,new Label("skeleton file:"));
+ panel.add(0,1,2,1,skelFile);
+ panel.add(2,1,1,1,Handles.TOP, skelBrowse);
+
+ panel.add(0,2,1,1,Handles.BOTTOM,new Label("code:"));
+ panel.add(0,3,1,1,tableG);
+ panel.add(0,4,1,1,switchG);
+ panel.add(0,5,1,1,packG);
+
+ panel.add(1,3,1,1,dump);
+ panel.add(1,4,1,1,verbose);
+ panel.add(1,5,1,1,time);
+
+
+ panel.add(2,3,1,1,no_minimize);
+ panel.add(2,4,1,1,no_backup);
+
+ panel.add(3,3,1,1,jlex);
+ panel.add(3,4,1,1,dot);
+
+ add("Center",panel);
+
+ updateState();
+ }
+
+ private void skelBrowse() {
+ FileDialog d = new FileDialog(owner , "Choose file", FileDialog.LOAD);
+ d.show();
+
+ if (d.getFile() != null) {
+ File skel = new File(d.getDirectory()+d.getFile());
+ try {
+ Skeleton.readSkelFile(skel);
+ skelFile.setText(skel.toString());
+ }
+ catch (GeneratorException e) {
+ // do nothing
+ }
+ }
+ }
+
+ private void setGenMethod() {
+ if ( tableG.getState() ) {
+ Options.gen_method = Options.TABLE;
+ return;
+ }
+
+ if ( switchG.getState() ) {
+ Options.gen_method = Options.SWITCH;
+ return;
+ }
+
+ if ( packG.getState() ) {
+ Options.gen_method = Options.PACK;
+ return;
+ }
+ }
+
+ private void updateState() {
+ dump.setState(Options.dump);
+ verbose.setState(Options.verbose);
+ jlex.setState(Options.jlex);
+ no_minimize.setState(Options.no_minimize);
+ no_backup.setState(Options.no_backup);
+ time.setState(Options.time);
+ dot.setState(Options.dot);
+
+ tableG.setState(Options.gen_method == Options.TABLE);
+ switchG.setState(Options.gen_method == Options.SWITCH);
+ packG.setState(Options.gen_method == Options.PACK);
+ }
+
+ private void setDefaults() {
+ Options.setDefaults();
+ Skeleton.readDefault();
+ skelFile.setText("");
+ updateState();
+ }
+
+ public void close() {
+ hide();
+ }
+
+}
Index: /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/src/JFlex/sym.java
===================================================================
--- /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/src/JFlex/sym.java (revision 25585)
+++ /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/src/JFlex/sym.java (revision 25585)
@@ -0,0 +1,61 @@
+
+//----------------------------------------------------
+// The following code was generated by CUP v0.11a beta 20060608
+// Sat Jan 31 23:52:43 EST 2009
+//----------------------------------------------------
+
+package JFlex;
+
+/** CUP generated interface containing symbol constants. */
+public interface sym {
+ /* terminals */
+ public static final int DELIMITER = 9;
+ public static final int EOFRULE = 26;
+ public static final int STRING_I = 46;
+ public static final int CHAR = 40;
+ public static final int CONCAT = 45;
+ public static final int MACROUSE = 42;
+ public static final int LOWERCLASS = 25;
+ public static final int EQUALS = 10;
+ public static final int CCLASSNOT = 44;
+ public static final int REPEAT = 32;
+ public static final int TILDE = 39;
+ public static final int CHAR_I = 47;
+ public static final int STAR = 33;
+ public static final int BAR = 35;
+ public static final int FULL = 17;
+ public static final int LOOKAHEAD = 28;
+ public static final int LESSTHAN = 12;
+ public static final int BANG = 38;
+ public static final int COMMA = 11;
+ public static final int JLETTERDIGITCLASS = 21;
+ public static final int PLUS = 34;
+ public static final int USERCODE = 31;
+ public static final int EOF = 0;
+ public static final int error = 1;
+ public static final int DASH = 8;
+ public static final int CLOSEBRACKET = 3;
+ public static final int HAT = 4;
+ public static final int JLETTERCLASS = 20;
+ public static final int IDENT = 30;
+ public static final int ACTION = 29;
+ public static final int CLOSECLASS = 7;
+ public static final int DIGITCLASS = 23;
+ public static final int LBRACE = 14;
+ public static final int REGEXPEND = 19;
+ public static final int OPENCLASS = 6;
+ public static final int OPENBRACKET = 2;
+ public static final int POINT = 37;
+ public static final int LETTERCLASS = 22;
+ public static final int MORETHAN = 13;
+ public static final int DOLLAR = 5;
+ public static final int RBRACE = 15;
+ public static final int STRING = 41;
+ public static final int QUESTION = 36;
+ public static final int UPPERCLASS = 24;
+ public static final int NOACTION = 27;
+ public static final int CCLASS = 43;
+ public static final int ASCII = 16;
+ public static final int UNICODE = 18;
+}
+
Index: /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/src/JFlex/tests/AllTests.java
===================================================================
--- /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/src/JFlex/tests/AllTests.java (revision 25585)
+++ /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/src/JFlex/tests/AllTests.java (revision 25585)
@@ -0,0 +1,50 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * jflex *
+ * Copyright (C) 1998-2009 Gerwin Klein *
+ * All rights reserved. *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License. See the file *
+ * COPYRIGHT for more information. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License along *
+ * with this program; if not, write to the Free Software Foundation, Inc., *
+ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *
+ * *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+package JFlex.tests;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
+/**
+ * AllTests
+ *
+ * @author Gerwin Klein
+ * @version $Revision: 433 $, $Date: 2009-01-31 19:52:34 +1100 (Sat, 31 Jan 2009) $
+ */
+public class AllTests {
+
+ public static void main(String[] args) {
+ junit.textui.TestRunner.run(AllTests.class);
+ }
+
+ public static Test suite() {
+ TestSuite suite = new TestSuite("JFlex tests");
+ //$JUnit-BEGIN$
+ suite.addTest(new TestSuite(AntTaskTests.class));
+ suite.addTest(new TestSuite(CharClassesTest.class));
+ suite.addTest(new TestSuite(EmitterTest.class));
+ suite.addTest(new TestSuite(RegExpTests.class));
+ suite.addTest(new TestSuite(SkeletonTest.class));
+ suite.addTest(new TestSuite(PackEmitterTest.class));
+ //$JUnit-END$
+ return suite;
+ }
+}
Index: /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/src/JFlex/tests/AntTaskTests.java
===================================================================
--- /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/src/JFlex/tests/AntTaskTests.java (revision 25585)
+++ /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/src/JFlex/tests/AntTaskTests.java (revision 25585)
@@ -0,0 +1,167 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * JFlex 1.4.3 *
+ * Copyright (C) 1998-2009 Gerwin Klein *
+ * All rights reserved. *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License. See the file *
+ * COPYRIGHT for more information. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License along *
+ * with this program; if not, write to the Free Software Foundation, Inc., *
+ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *
+ * *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+package JFlex.tests;
+
+import java.io.File;
+import java.io.IOException;
+
+import JFlex.Options;
+import JFlex.anttask.JFlexTask;
+
+import junit.framework.TestCase;
+
+/**
+ * Unit tests for the jflex ant task.
+ *
+ * @author Gerwin Klein
+ * @version $Revision: 433 $, $Date: 2009-01-31 19:52:34 +1100 (Sat, 31 Jan 2009) $
+ */
+public class AntTaskTests extends TestCase {
+
+ private JFlexTask task;
+
+ /**
+ * Constructor for AntTaskTests.
+ *
+ * @param name test case name
+ */
+ public AntTaskTests(String name) {
+ super(name);
+ }
+
+ /*
+ * @see TestCase#setUp()
+ */
+ protected void setUp() throws Exception {
+ super.setUp();
+ Options.setDefaults();
+ task = new JFlexTask();
+ }
+
+ public void testPackageAndClass() throws IOException {
+ task.setFile(new File("src/JFlex/LexScan.flex"));
+ task.findPackageAndClass();
+ assertEquals(task.getPackage(), "JFlex");
+ assertEquals(task.getClassName(), "LexScan");
+ }
+
+ public void testPackageAndClassDefaults() throws IOException {
+ task.setFile(new File("examples/simple/simple.flex"));
+ task.findPackageAndClass();
+ assertEquals(task.getPackage(), null);
+ assertEquals(task.getClassName(), "Yylex");
+ }
+
+ public void testDestdir() throws IOException {
+ task.setFile(new File("src/JFlex/LexScan.flex"));
+ File dir = new File("src");
+ task.setDestdir(dir);
+ task.findPackageAndClass();
+ task.normalizeOutdir();
+ // not default jflex logic, but javac (uses package name)
+ assertEquals(Options.getDir(), new File(dir, "JFlex"));
+ }
+
+ public void testOutdir() throws IOException {
+ task.setFile(new File("src/JFlex/LexScan.flex"));
+ File dir = new File("src");
+ task.setOutdir(dir);
+ task.findPackageAndClass();
+ task.normalizeOutdir();
+ // this should be default jflex logic
+ assertEquals(Options.getDir(), dir);
+ }
+
+ public void testDefaultDir() throws IOException {
+ task.setFile(new File("src/JFlex/LexScan.flex"));
+ task.findPackageAndClass();
+ task.normalizeOutdir();
+ // this should be default jflex logic
+ assertEquals(Options.getDir(), new File("src/JFlex"));
+ }
+
+ public void testNomin() {
+ assertTrue(!Options.no_minimize);
+ task.setNomin(true);
+ assertTrue(Options.no_minimize);
+ }
+
+ public void testSkipMinimization() {
+ assertTrue(!Options.no_minimize);
+ task.setSkipMinimization(true);
+ assertTrue(Options.no_minimize);
+ }
+
+ public void testNobak() {
+ assertTrue(!Options.no_backup);
+ task.setNobak(true);
+ assertTrue(Options.no_backup);
+ }
+
+ public void testCodeGen() {
+ task.setSwitch(true);
+ assertEquals(Options.gen_method, Options.SWITCH);
+ task.setTable(true);
+ assertEquals(Options.gen_method, Options.TABLE);
+ task.setPack(true);
+ assertEquals(Options.gen_method, Options.PACK);
+ }
+
+ public void testSkel() {
+ task.setVerbose(false); // avoid to java console pop up
+ task.setSkeleton(new File("src/skeleton.nested"));
+ assertTrue(JFlex.Skeleton.line[3].indexOf("java.util.Stack") > 0);
+ }
+
+ public void testVerbose() {
+ task.setVerbose(false);
+ assertTrue(!Options.verbose);
+ task.setVerbose(true);
+ assertTrue(Options.verbose);
+ }
+
+ public void testTime() {
+ assertTrue(!Options.time);
+ task.setTimeStatistics(true);
+ assertTrue(Options.time);
+ task.setTime(false);
+ assertTrue(!Options.time);
+ }
+
+ public void testDot() {
+ assertTrue(!Options.dot);
+ task.setDot(true);
+ assertTrue(Options.dot);
+ task.setGenerateDot(false);
+ assertTrue(!Options.dot);
+ }
+
+ public void testDump() {
+ assertTrue(!Options.dump);
+ task.setDump(true);
+ assertTrue(Options.dump);
+ }
+
+ public void testJlex() {
+ assertTrue(!Options.jlex);
+ task.setJLex(true);
+ assertTrue(Options.jlex);
+ }
+}
Index: /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/src/JFlex/tests/CharClassesTest.java
===================================================================
--- /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/src/JFlex/tests/CharClassesTest.java (revision 25585)
+++ /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/src/JFlex/tests/CharClassesTest.java (revision 25585)
@@ -0,0 +1,103 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * JFlex 1.4.3 *
+ * Copyright (C) 1998-2009 Gerwin Klein *
+ * All rights reserved. *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License. See the file *
+ * COPYRIGHT for more information. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License along *
+ * with this program; if not, write to the Free Software Foundation, Inc., *
+ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *
+ * *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+package JFlex.tests;
+
+import JFlex.IntCharSet;
+import JFlex.Interval;
+import junit.framework.TestCase;
+
+/**
+ * CharClassesTest
+ *
+ * @author Gerwin Klein
+ * @version $Revision: 433 $, $Date: 2009-01-31 19:52:34 +1100 (Sat, 31 Jan 2009) $
+ */
+public class CharClassesTest extends TestCase {
+
+ /**
+ * Constructor for CharClassesTest.
+ * @param arg0
+ */
+ public CharClassesTest(String arg0) {
+ super(arg0);
+ }
+
+ public void testAdd1() {
+ IntCharSet set = new IntCharSet(new Interval('a','h'));
+ set.add(new Interval('o','z'));
+ set.add(new Interval('A','Z'));
+ set.add(new Interval('h','o'));
+ assertEquals("{ ['A'-'Z']['a'-'z'] }", set.toString());
+ }
+
+ public void testAdd2() {
+ IntCharSet set = new IntCharSet(new Interval('a','h'));
+ set.add(new Interval('o','z'));
+ set.add(new Interval('A','Z'));
+ set.add(new Interval('i','n'));
+ assertEquals("{ ['A'-'Z']['a'-'z'] }", set.toString());
+ }
+
+ public void testAdd3() {
+ IntCharSet set = new IntCharSet(new Interval('a','h'));
+ set.add(new Interval('o','z'));
+ set.add(new Interval('A','Z'));
+ set.add(new Interval('a','n'));
+ assertEquals("{ ['A'-'Z']['a'-'z'] }", set.toString());
+ }
+
+ public void testMergeLast() {
+ IntCharSet set = new IntCharSet(new Interval('a','k'));
+ assertEquals("{ ['a'-'k'] }", set.toString());
+ set.add('l');
+ assertEquals("{ ['a'-'l'] }", set.toString());
+ }
+
+ public void testAddChar() {
+ IntCharSet set = new IntCharSet(new Interval('a','h'));
+ set.add(new Interval('o','z'));
+ set.add('n');
+ set.add('k');
+ assertEquals("{ ['a'-'h']['k']['n'-'z'] }", set.toString());
+ set.add('i');
+ assertEquals("{ ['a'-'i']['k']['n'-'z'] }", set.toString());
+ set.add('j');
+ assertEquals("{ ['a'-'k']['n'-'z'] }", set.toString());
+ set.add(new Interval('l','m'));
+ assertEquals("{ ['a'-'z'] }", set.toString());
+ }
+
+ public void testCopy() {
+ IntCharSet set = new IntCharSet(new Interval('a','z'));
+ IntCharSet copy = set.copy();
+ Interval i = set.getNext();
+ i.end = 'h';
+ assertEquals("{ ['a'-'h'] }", set.toString());
+ assertEquals("{ ['a'-'z'] }", copy.toString());
+ }
+
+ public void testCaseless() {
+ IntCharSet set = new IntCharSet(new Interval('a','c'));
+ set.add(new Interval('h','o'));
+ assertEquals("{ ['A'-'C']['H'-'O']['a'-'c']['h'-'o'] }",
+ set.getCaseless().toString());
+ }
+}
Index: /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/src/JFlex/tests/EmitterTest.java
===================================================================
--- /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/src/JFlex/tests/EmitterTest.java (revision 25585)
+++ /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/src/JFlex/tests/EmitterTest.java (revision 25585)
@@ -0,0 +1,50 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * JFlex 1.4.3 *
+ * Copyright (C) 1998-2009 Gerwin Klein *
+ * All rights reserved. *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License. See the file *
+ * COPYRIGHT for more information. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License along *
+ * with this program; if not, write to the Free Software Foundation, Inc., *
+ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *
+ * *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+package JFlex.tests;
+
+import JFlex.Emitter;
+import junit.framework.TestCase;
+
+/**
+ * Some unit tests for the jflex Emitter class
+ *
+ * @author Gerwin Klein
+ * @version $Revision: 433 $, $Date: 2009-01-31 19:52:34 +1100 (Sat, 31 Jan 2009) $
+ */
+public class EmitterTest extends TestCase {
+
+ /**
+ * Constructor for EmitterTest.
+ * @param name the test name
+ */
+ public EmitterTest(String name) {
+ super(name);
+ }
+
+ public void testJavadoc() {
+ StringBuffer usercode = new StringBuffer("/* some *** comment */");
+ assertTrue(!Emitter.endsWithJavadoc(usercode));
+ usercode.append("import bla; /** javadoc /* */ ");
+ assertTrue(Emitter.endsWithJavadoc(usercode));
+ usercode.append("bla");
+ assertTrue(!Emitter.endsWithJavadoc(usercode));
+ }
+}
Index: /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/src/JFlex/tests/PackEmitterTest.java
===================================================================
--- /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/src/JFlex/tests/PackEmitterTest.java (revision 25585)
+++ /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/src/JFlex/tests/PackEmitterTest.java (revision 25585)
@@ -0,0 +1,80 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * jflex *
+ * Copyright (C) 1998-2009 Gerwin Klein *
+ * All rights reserved. *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License. See the file *
+ * COPYRIGHT for more information. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License along *
+ * with this program; if not, write to the Free Software Foundation, Inc., *
+ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *
+ * *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+package JFlex.tests;
+
+import junit.framework.TestCase;
+import JFlex.Out;
+import JFlex.PackEmitter;
+
+/**
+ * PackEmitterTest
+ *
+ * @author Gerwin Klein
+ * @version $Revision: 433 $, $Date: 2009-01-31 19:52:34 +1100 (Sat, 31 Jan 2009) $
+ */
+public class PackEmitterTest extends TestCase {
+
+ private PackEmitter p;
+
+
+ /**
+ * Constructor for PackEmitterTest.
+ */
+ public PackEmitterTest() {
+ super("PackEmitter test");
+ }
+
+ public void setUp() {
+ p = new PackEmitter("Bla") {
+ public void emitUnpack() { }
+ };
+ }
+
+ public void testInit() {
+ p.emitInit();
+ assertEquals(
+ " private static final int [] ZZ_BLA = zzUnpackBla();" + Out.NL +
+ Out.NL +
+ " private static final String ZZ_BLA_PACKED_0 =" + Out.NL +
+ " \"",
+ p.toString());
+ }
+
+ public void testEmitUCplain() {
+ p.emitUC(8);
+ p.emitUC(0xFF00);
+
+ assertEquals("\\10\\uff00", p.toString());
+ }
+
+ public void testLineBreak() {
+ for (int i = 0; i < 36; i++) {
+ p.breaks();
+ p.emitUC(i);
+ }
+ System.out.println(p);
+ assertEquals(
+ "\\0\\1\\2\\3\\4\\5\\6\\7\\10\\11\\12\\13\\14\\15\\16\\17\"+"+Out.NL+
+ " \"\\20\\21\\22\\23\\24\\25\\26\\27\\30\\31\\32\\33\\34\\35\\36\\37\"+"+Out.NL+
+ " \"\\40\\41\\42\\43",
+ p.toString());
+ }
+}
Index: /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/src/JFlex/tests/RegExpTests.java
===================================================================
--- /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/src/JFlex/tests/RegExpTests.java (revision 25585)
+++ /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/src/JFlex/tests/RegExpTests.java (revision 25585)
@@ -0,0 +1,62 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * JFlex 1.4.3 *
+ * Copyright (C) 1998-2009 Gerwin Klein *
+ * All rights reserved. *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License. See the file *
+ * COPYRIGHT for more information. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License along *
+ * with this program; if not, write to the Free Software Foundation, Inc., *
+ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *
+ * *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+package JFlex.tests;
+
+import JFlex.*;
+import junit.framework.TestCase;
+
+/**
+ * Unit tests for JFlex.RegExp
+ *
+ * @author Gerwin Klein
+ * @version $Revision: 433 $, $Date: 2009-01-31 19:52:34 +1100 (Sat, 31 Jan 2009) $
+ */
+public class RegExpTests extends TestCase implements sym {
+
+ /**
+ * Constructor for RegExpTests.
+ *
+ * @param name the test name
+ */
+ public RegExpTests(String name) {
+ super(name);
+ }
+
+ public void testrevString() {
+ assertTrue(RegExp.revString("blah").equals("halb"));
+ }
+
+ public void testCharClass() {
+ Macros m = new Macros();
+ RegExp e1 = new RegExp1(CCLASS, new Interval('a','z'));
+ RegExp e2 = new RegExp1(CHAR, new Character('Z'));
+ RegExp e3 = new RegExp1(CCLASS, new Interval('0','9'));
+ m.insert("macro", e3);
+ RegExp s = new RegExp1(STAR, e1);
+ RegExp u = new RegExp1(MACROUSE, "macro");
+ RegExp b = new RegExp2(BAR, e2, u);
+ assertTrue(e1.isCharClass(m));
+ assertTrue(e2.isCharClass(m));
+ assertTrue(b.isCharClass(m));
+ assertTrue(!s.isCharClass(m));
+ assertTrue(u.isCharClass(m));
+ }
+}
Index: /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/src/JFlex/tests/SkeletonTest.java
===================================================================
--- /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/src/JFlex/tests/SkeletonTest.java (revision 25585)
+++ /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/src/JFlex/tests/SkeletonTest.java (revision 25585)
@@ -0,0 +1,63 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * JFlex 1.4.3 *
+ * Copyright (C) 1998-2009 Gerwin Klein *
+ * All rights reserved. *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License. See the file *
+ * COPYRIGHT for more information. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License along *
+ * with this program; if not, write to the Free Software Foundation, Inc., *
+ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *
+ * *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+package JFlex.tests;
+
+
+import java.io.File;
+
+import JFlex.Skeleton;
+import junit.framework.TestCase;
+
+/**
+ * SkeletonTest
+ *
+ * @author Gerwin Klein
+ * @version $Revision: 433 $, $Date: 2009-01-31 19:52:34 +1100 (Sat, 31 Jan 2009) $
+ */
+public class SkeletonTest extends TestCase {
+
+ /**
+ * Constructor for SkeletonTest.
+ * @param arg0 test name
+ */
+ public SkeletonTest(String arg0) {
+ super(arg0);
+ }
+
+ public void testReplace() {
+ assertEquals(Skeleton.replace("bla ", "blub", "bla blub bla "),
+ "blubblub blub");
+ }
+
+ public void testMakePrivate() {
+ Skeleton.makePrivate();
+ for (int i=0; i < Skeleton.line.length; i++) {
+ assertEquals(Skeleton.line[i].indexOf("public"), -1);
+ }
+ }
+
+ public void testDefault() {
+ Skeleton.readSkelFile(new File("src/skeleton.nested"));
+ assertTrue(JFlex.Skeleton.line[3].indexOf("java.util.Stack") > 0);
+ Skeleton.readDefault();
+ assertEquals(JFlex.Skeleton.line[3].indexOf("java.util.Stack"), -1);
+ }
+}
Index: /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/src/README
===================================================================
--- /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/src/README (revision 25585)
+++ /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/src/README (revision 25585)
@@ -0,0 +1,46 @@
+This directory contains the source code for JFlex.
+
+Dependencies
+
+You need the following tools in your class path:
+
+ant.jar >= 1.4
+
+To compile, run first
+
+ant gettoolds
+(this will download JFlex, java_cup, and junit jars for bootstrapping)
+
+then, run
+ant jar
+
+
+The command "ant help" should give you other useful targets.
+
+
+Directory contents:
+manifest:
+ jar manifest file for JFlex.jar
+
+skeleton:
+ a skeleton file matching exactly the precompiled scanner skeleton.
+ Can be used together with the --skel option
+
+skeleton.nested:
+ a skeleton file that supports nested input streams (see the manual
+ for the API). Can be used together with the --skel option
+
+JFlex:
+ source files of package JFlex
+
+JFlex/gui:
+ source files of package JFlex.gui
+
+JFlex/anttask
+ source files of the JFlex Ant task (contributed by Rafal Mantiuk)
+
+JFlex/test
+ unit tests for JFlex
+
+java_cup/runtime:
+ CUP 11a beta 20060608 runtime classes, used by JFlex
Index: /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/src/build.xml
===================================================================
--- /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/src/build.xml (revision 25585)
+++ /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/src/build.xml (revision 25585)
@@ -0,0 +1,114 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Index: /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/src/changelog
===================================================================
--- /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/src/changelog (revision 25585)
+++ /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/src/changelog (revision 25585)
@@ -0,0 +1,277 @@
+* JFlex 1.4.3 (Jan 31, 2009)
+- fixed bug #2018299 (lookahead syntax error)
+- fixed bug #2010261 (min_int in Java example scanner)
+- fixed bug #2007221 (zzEOFDone not reset in yyreset(Reader))
+- fixed bug #1999301 (%type and %int at the same time should produce error msg)
+
+* JFlex 1.4.2 (May 27, 2008)
+- implemented feature request #1212181:
+ Now supports generics syntax for %type, %extends, etc
+- implemented feature request #1762500:
+ Provided %ctorarg option to add arguments to constructor
+- fixed bug #1464525 (Reader.read might return 0)
+- fixed bug #1968897 (Ambiguous error message in macro expansion)
+- fixed bug #1832973 (Syntax error in input may cause NullPointerException)
+- fixed bug #1629920 (Need to defend against path blanks in jflex bash script)
+- fixed bug #1540228 (EOF actions may be ignored for same lex state)
+- fixed bug #1498726 (syntax error in generated ZZ_CMAP)
+- fixed bug #1282840 (lookahead and "|" actions)
+- fixed bug #1164852 (yytext() longer than expected with lookahead)
+- fixed bug #1065521 (OS/2 Java 1.1.8 Issues)
+- fixed bug #421495 (dangerous lookahead check may fail)
+
+* JFlex 1.4.1 (November 7, 2004)
+- merged in patch by Don Brown (fixes #1049791 Uses Old JUnit method assertFalse)
+- merged in patch by Don Brown (fixes #887821 buffer expansion bug in yy_refill())
+ Thanks to Binesh Bannerjee for providing a simpler test case for this problem.
+- fixed bug #1035407 (ArrayIndexOutOfBounds in IntCharSet)
+- fixed bug #1003569 (Cannot use lookahead with ignorecase)
+- converted dangerous lookahead error to warning
+- print info for EOF actions as well in %debug mode
+- fixed line number count for EOF actions
+- internal: removed unused methods in LexScan.flex and IntCharSet
+
+* JFlex 1.4 (April 12, 2004)
+- new, very fast minimization algorithm (also fixes memory issues)
+- new --jlex option for strict compatibility to JLex. Currently it
+ changes %ignorecase to JLex semantics, that is, character classes
+ are interpreted in a caseless way, too.
+ (fixes bus #751757, %ignorecase ignored by char classes).
+ Thanks to Edward D. Willink for spotting the incompatibility.
+- support for even larger scanners (up to 64K DFA states).
+ Thanks to Karin Vespoor.
+- removed eclipse compiler warnings for generated classes
+ (feature request #778747)
+- implemented faster character classes (feature request #604589).
+ Expressions like [a-z] | [A-Z] are interpreted as one atomic class
+ [a-zA-Z], reducing NFA states and generation time significantly
+ for some specifications. This affects the generation process only,
+ generated scanners remain the same.
+- new %apiprivate switch (feature request #513500/1) that causes all
+ generated and skeleton methods to be made private. Exceptions to this
+ are user defined functions and the constructor. Thanks to Stephen
+ Ostermiller for the suggestion.
+- allow user defined javadoc class comments (feature request #513500/2)
+ If the user code section ends with a javadoc comment, JFlex takes this
+ instead of the generated comment. Thanks to Stephen Ostermiller for
+ the suggestion.
+- fixed bug #491095 (undefined macros in complement expressions do
+ not throw exception in generator). Thanks to Stephen Ostermiller
+ for the bug report.
+- fixed bug #495422 (yypushStream/yypopStream in skeleton.nested
+ work as advertised)
+- fixed bug #611118 (no wrong macro warnings on regexp negation)
+- fixed bug #655528 (%cupsym now also affects %cupdebug)
+ Thanks to Eric Schweitz for the fix.
+- fixed bug #510010 (single-line %initthrow works now
+ in case of extra whitespace before newline)
+- yyreset() does no longer close the associated reader (use yyclose()
+ explicitly for that). Makes some reader objects reusable (feature
+ request #513492). Thanks to Stephen Ostermiller for the suggestion.
+- fixed modifier order in generated code, removes jikes compiler warnings
+ Thanks to Michael Wildpaner for the fix.
+- ant task now also works with ant >= 1.4 (fixes bug #526905)
+- yyreset() does not declare an execption any more (fixes bug #913132)
+- %cup does not include %eofclose in JLex mode (--jlex). (Fixes bug #910562)
+- optional parameter to %eofclose: "%eofclose false" turns off %eofclose if
+ it was turned on previously (e.g. by %cup). (Fixes bug #910562)
+- jflex build script switched to ant
+- internal: central Options class for better integration with
+ build tools and IDEs
+- internal: change naming scheme for generated internal variables from
+ yy_ to zz to comply with Java naming standard. Thanks to Max Gilead
+ for the patch.
+
+
+* JFlex 1.3.5 (October 8, 2001)
+- fixed all bugs reported for version 1.3.4. Thanks to
+ Amin Ahmad and Fred Wehrhahn for their excellent bug reports.
+- implemented feature request #459014: vim syntax file.
+ Thanks to Michael Brailsford for his help and suggestions.
+- JFlex should run with JDK 1.1 out-of-the-box again.
+
+
+* JFlex 1.3.4 (October 1, 2001)
+- fixed all bugs reported for version 1.3.3. Thanks to Mike Akerman
+ for his excellent bug reports and his help.
+- implemented feature request #459355: exclusive start states.
+ Thanks to Ed Beroset for the suggestion.
+- introduced %s and %x shorthands for state declarations
+
+
+* JFlex 1.3.3 (September 21, 2001)
+- fixed all reported bugs except #39 (lookahead check at generation
+ time may fail). Thanks to Axel Schwolow, Karl Meissner, Angelo
+ Borsotti, and Paolo Di Francesco for their excellent bug reports.
+- enhanced %debug output. JFlex scanners in debug mode now print line,
+ column, matched text, and executed action (with line number in spec)
+ for each processed token. Thanks to
+ Karl Meissner for the
+ suggestion.
+- introduced %cupdebug directive for readable CUP debugging. Generated
+ scanners print line, column, matched text, and CUP symbol name for
+ each returned token. Again thanks to Karl Meissner for tips and
+ contributed Java reflection code.
+- new %cupsym to customize CUP generated symbols class name. Thanks
+ to Karl Meissner and Paolo Di Francesco.
+- new %throws as shorthand for %yylexthrow
+- code generation now customizable at command line with --table,
+ --pack, and --switch
+- command line switch --info prints system and JVM information (useful
+ for bug reports)
+- command line switch --nobak for not generating backup files
+- an Ant task for the Ant build tool http://jakarta.apache.org/ant/
+ contributed by Rafal Mantiuk. Many thanks to him.
+- better error message for missing ] in char class. Thanks to Karl
+ Meissner.
+- performance enhancements in the runtime system. The engine is now
+ 10%-50% faster. These are only the first implementations of a few of
+ the many suggestions from Angelo Borsotti. Thanks to Angelo for many
+ insights, tips, and fruitful discussions.
+- a new warning if a rule can never be matched
+- macros and regular expression can now span multiple lines (note
+ that | at the end of a line in a rule is a special action,
+ not the | operator)
+- updated the manual to contain more information about the generated
+ class, clarified the description of lexical states. Thanks to Michael
+ Binz, Angelo Borsotti, Vasily Karyaev and for the suggestions.
+- Simplified java example lexer, and allow // style comments at EOF.
+ Thanks to Thomas Mulcahy.
+- Byacc/J example updated to version 1.1
+- New interpreter example using CUP. Thanks to Bernhard Rumpe for
+ the code.
+
+
+* JFlex 1.3.2 (February 24, 2001)
+- fixed bug #32 (this time for real). Thanks to Thilo Goetz for
+ his quick report.
+- updated the binary scanning example with the more comprehensive and
+ usable class StraightStreamReader by Stephen Ostermiller. Thanks go to
+ him for his contribution. The original version of this class is at
+ http://www.smo.f2s.com/utils/
+- added a link to a Japanese translation of the JFlex manual (it's in Japanese
+ Shift_JIS encoding). The translation is for an older release (1.1.2), but
+ most of the text still applies to the current version. See the change log
+ for the differences between 1.1.2 and the current version. Many thanks to
+ Yuichi Nakajima, Yukio Ikeda, Katsuhiko Yamazaki, and Koji Ooya for
+ their efforts.
+ If you would like to translate the JFlex manual into another language, or
+ if you already have done so, please let me know. I will include a link to
+ it on the documentation page. I can also give you access to the latex
+ sources of the manual, so that printable versions of your translation can
+ be generated, too.
+
+
+* JFlex 1.3.1 (February 20, 2001)
+- fixed all JFlex bugs reported for 1.3 (bugs #32-#36)
+ Thanks to Hans Kratz, Vasily Karyaev, Alexey Yakovets, and Tom Moog for
+ their excellent reports.
+- added two new example scanners:
+ . a demonstration how to scan binary files
+ . a small calculator example for Cup, based on the example in the Linux
+ Gazette by Richard A. Sevenich and Christopher Lopes. See also
+ http://www.linuxgazette.com/issue39/sevenich.html
+ http://www.linuxgazette.com/issue41/sevenich.html
+ http://www.linuxgazette.com/issue41/lopes/lopes.html
+- manual section about encodings, platforms and Unicode.
+ Thanks to Stephen Ostermiller for his valuable input.
+- switch for skipping the minimization step in DFA generation (--nomin).
+ This feature is still in alpha status and not yet extensively tested. It
+ might be useful when you have very large scanners and not much memory
+ available.
+- switch for generating graphviz dot files for graphical representation (ps
+ or gif) of generated NFA, DFA and minimized DFA (--dot). Might be useful for
+ teaching. This feature is also still in alpha status and not fully finished
+ yet. It is included as preview, comments are welcome, please try it out and
+ tell me what you think. For information on graphviz see
+ http://www.research.att.com:80/sw/tools/graphviz/
+- changed to --style long command line switches (single - still recognized).
+- moved part of the project to http://sourceforge.net/projects/jflex/
+
+
+* JFlex 1.3 (October 21, 2000)
+
+- Fixed all bugs reported for 1.2.2 (bugs #23-#27).
+- Better start script for Linux.
+- Customize for internal error handling in yy_ScanError.
+- Empty charclass [], and any (=negated empty) charclass [^].
+- New negation operator ! for regexps.
+- New upto operator ~ for regexps.
+- Customizable buffer size (%buffer).
+- New char yycharat(int) for efficient access to single characters in matched text.
+- Split up of too large lex tables for even larger scanner sizes.
+- New additional external skeleton with support for nested input streams.
+- JLex compatibility: BOL ^ and EOL $ use unicode line separators as in
+ http://www.unicode.org/unicode/reports/tr18/tr18-5.1.html.
+- New resetStream method for reusing scanner objects.
+_ BYacc/J support (%byaccj) + BYacc/J example.
+- Include files in lexer specs (%include).
+- New --dump switch for a dump of the generated charclasses, NFA, DFA, and minimized DFA tables.
+
+
+* JFlex 1.2.2 (August 23, 1999)
+- Updated JFlex to the new CUP version 0.10j.
+- Eliminated some remaining platform dependent newlines in the generated source code
+ (affecting the readabilty of the generated code only, no functional changes).
+- Minor improvements in error reporting (out of memory).
+- Added a --version command line option for printing the current jflex version.
+- Updated the Java 1.2 lexer/parser example to CUP 0.10j.
+
+
+* JFlex 1.2.1 (June 25, 1999)
+- Fixed all bugs reported for version 1.2 (#19-#22).
+- Webpage redesigned and moved to http://www.jflex.de.
+- Example java lexer/parser switched to Java 1.2.
+
+
+* JFlex 1.2 (March 21, 1999)
+- Fixed all bugs for 1.1.2.
+- JFlex now works again with Solaris JIT.
+- Significant Unicode optimizations in scanning and generation performance,
+- changed the empty string match wrt. EOF behavior to the one that is commonly expected.
+- added command line switches for more customization
+- external skeleton files
+- new GUI without any console output
+- <> as in lex/flex
+- better error messages
+- better generation speed
+- better generation memory efficiency
+- | Action, trailing context (/ operator)
+- new %final, %abstract and %extends directives
+- uses jar file
+- included makefile for JFlex,
+- %pack now uses string packing,
+- %pack now default code generation method,
+- new %switch directive for old default code generation method,
+- more convenient declaration of exceptions,
+- new %int switch,
+- manual now written in latex, available as html and in printable .ps.gz and pdf file formats.
+
+
+* JFlex 1.1.2
+- All bugs reported for version 1.1.1 (#8-#10) have been fixed.
+
+
+* JFlex 1.1.1
+- All bugs reported for version 1.1 (i.e. bug #7 and feature request #6) have been fixed.
+- Scanning speed was optimized further.
+
+
+* JFlex 1.1 adds new features and fixes all known bugs of 1.0
+- Revised directory structure.
+- Fixed all reported bugs (#1-#5 and some unreported ones).
+- Fixed thousands of typos in the manual.
+- whitespace characters in regular expressions,
+- flex style repeat expressions,
+- %caseless switch,
+- %eofclose switch,
+- method for closing the input stream,
+- method for the current lexical state,
+- method for rereading matched text,
+- backup of files that are overwitten in the generation process,
+- improved error reporting,
+- graphical UI when no filename is provided on the commandline
+
+
+* JFlex 1.0 (May 1998) was the first public release of JFlex.
+ It was developed using Sun's JDK 1.1, JFlex (bootstrapped) and the parser generator CUP
Index: /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/src/java_cup/runtime/ComplexSymbolFactory.java
===================================================================
--- /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/src/java_cup/runtime/ComplexSymbolFactory.java (revision 25585)
+++ /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/src/java_cup/runtime/ComplexSymbolFactory.java (revision 25585)
@@ -0,0 +1,119 @@
+package java_cup.runtime;
+
+/**
+ * Default Implementation for SymbolFactory, creates
+ * plain old Symbols
+ *
+ * @version last updated 27-03-2006
+ * @author Michael Petter
+ */
+
+/* *************************************************
+ class DefaultSymbolFactory
+
+ interface for creating new symbols
+ ***************************************************/
+public class ComplexSymbolFactory implements SymbolFactory{
+ public static class Location {
+ private String unit="unknown";
+ private int line, column;
+ public Location(String unit, int line, int column){
+ this.unit=unit;
+ this.line=line;
+ this.column=column;
+ }
+ public Location(int line, int column){
+ this.line=line;
+ this.column=column;
+ }
+ public String toString(){
+ return unit+":"+line+"/"+column;
+ }
+ public int getColumn(){
+ return column;
+ }
+ public int getLine(){
+ return line;
+ }
+ public String getUnit(){
+ return unit;
+ }
+ }
+ /**
+ * ComplexSymbol with detailed Location Informations and a Name
+ */
+ public static class ComplexSymbol extends Symbol {
+ protected String name;
+ protected Location xleft,xright;
+ public ComplexSymbol(String name, int id) {
+ super(id);
+ this.name=name;
+ }
+ public ComplexSymbol(String name, int id, Object value) {
+ super(id,value);
+ this.name=name;
+ }
+ public String toString(){
+ if (xleft==null || xright==null) return "Symbol: "+name;
+ return "Symbol: "+name+" ("+xleft+" - "+xright+")";
+ }
+ public ComplexSymbol(String name, int id, int state) {
+ super(id,state);
+ this.name=name;
+ }
+ public ComplexSymbol(String name, int id, Symbol left, Symbol right) {
+ super(id,left,right);
+ this.name=name;
+ if (left!=null) this.xleft = ((ComplexSymbol)left).xleft;
+ if (right!=null) this.xright= ((ComplexSymbol)right).xright;
+ }
+ public ComplexSymbol(String name, int id, Location left, Location right) {
+ super(id);
+ this.name=name;
+ this.xleft=left;
+ this.xright=right;
+ }
+ public ComplexSymbol(String name, int id, Symbol left, Symbol right, Object value) {
+ super(id,value);
+ this.name=name;
+ if (left!=null) this.xleft = ((ComplexSymbol)left).xleft;
+ if (right!=null) this.xright= ((ComplexSymbol)right).xright;
+ }
+ public ComplexSymbol(String name, int id, Location left, Location right, Object value) {
+ super(id,value);
+ this.name=name;
+ this.xleft=left;
+ this.xright=right;
+ }
+ public Location getLeft(){
+ return xleft;
+ }
+ public Location getRight(){
+ return xright;
+ }
+ }
+
+
+ // Factory methods
+ public Symbol newSymbol(String name, int id, Location left, Location right, Object value){
+ return new ComplexSymbol(name,id,left,right,value);
+ }
+ public Symbol newSymbol(String name, int id, Location left, Location right){
+ return new ComplexSymbol(name,id,left,right);
+ }
+ public Symbol newSymbol(String name, int id, Symbol left, Symbol right, Object value){
+ return new ComplexSymbol(name,id,left,right,value);
+ }
+ public Symbol newSymbol(String name, int id, Symbol left, Symbol right){
+ return new ComplexSymbol(name,id,left,right);
+ }
+ public Symbol newSymbol(String name, int id){
+ return new ComplexSymbol(name,id);
+ }
+ public Symbol newSymbol(String name, int id, Object value){
+ return new ComplexSymbol(name,id,value);
+ }
+ public Symbol startSymbol(String name, int id, int state){
+ return new ComplexSymbol(name,id,state);
+ }
+}
Index: /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/src/java_cup/runtime/DefaultSymbolFactory.java
===================================================================
--- /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/src/java_cup/runtime/DefaultSymbolFactory.java (revision 25585)
+++ /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/src/java_cup/runtime/DefaultSymbolFactory.java (revision 25585)
@@ -0,0 +1,52 @@
+package java_cup.runtime;
+
+/**
+ * Default Implementation for SymbolFactory, creates
+ * plain old Symbols
+ *
+ * @version last updated 27-03-2006
+ * @author Michael Petter
+ */
+
+/* *************************************************
+ class DefaultSymbolFactory
+
+ interface for creating new symbols
+ ***************************************************/
+public class DefaultSymbolFactory implements SymbolFactory{
+ // Factory methods
+ /**
+ * DefaultSymbolFactory for CUP.
+ * Users are strongly encoraged to use ComplexSymbolFactory instead, since
+ * it offers more detailed information about Symbols in source code.
+ * Yet since migrating has always been a critical process, You have the
+ * chance of still using the oldstyle Symbols.
+ *
+ * @deprecated as of CUP v11a
+ * replaced by the new java_cup.runtime.ComplexSymbolFactory
+ */
+ //@deprecated
+ public DefaultSymbolFactory(){
+ }
+ public Symbol newSymbol(String name ,int id, Symbol left, Symbol right, Object value){
+ return new Symbol(id,left,right,value);
+ }
+ public Symbol newSymbol(String name, int id, Symbol left, Symbol right){
+ return new Symbol(id,left,right);
+ }
+ public Symbol newSymbol(String name, int id, int left, int right, Object value){
+ return new Symbol(id,left,right,value);
+ }
+ public Symbol newSymbol(String name, int id, int left, int right){
+ return new Symbol(id,left,right);
+ }
+ public Symbol startSymbol(String name, int id, int state){
+ return new Symbol(id,state);
+ }
+ public Symbol newSymbol(String name, int id){
+ return new Symbol(id);
+ }
+ public Symbol newSymbol(String name, int id, Object value){
+ return new Symbol(id,value);
+ }
+}
Index: /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/src/java_cup/runtime/Scanner.java
===================================================================
--- /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/src/java_cup/runtime/Scanner.java (revision 25585)
+++ /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/src/java_cup/runtime/Scanner.java (revision 25585)
@@ -0,0 +1,25 @@
+package java_cup.runtime;
+
+/**
+ * Defines the Scanner interface, which CUP uses in the default
+ * implementation of lr_parser.scan()
. Integration
+ * of scanners implementing Scanner
is facilitated.
+ *
+ * @version last updated 23-Jul-1999
+ * @author David MacMahon
+ */
+
+/* *************************************************
+ Interface Scanner
+
+ Declares the next_token() method that should be
+ implemented by scanners. This method is typically
+ called by lr_parser.scan(). End-of-file can be
+ indicated either by returning
+ new Symbol(lr_parser.EOF_sym())
or
+ null
.
+ ***************************************************/
+public interface Scanner {
+ /** Return the next token, or null
on end-of-file. */
+ public Symbol next_token() throws java.lang.Exception;
+}
Index: /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/src/java_cup/runtime/Symbol.java
===================================================================
--- /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/src/java_cup/runtime/Symbol.java (revision 25585)
+++ /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/src/java_cup/runtime/Symbol.java (revision 25585)
@@ -0,0 +1,116 @@
+package java_cup.runtime;
+
+/**
+ * Defines the Symbol class, which is used to represent all terminals
+ * and nonterminals while parsing. The lexer should pass CUP Symbols
+ * and CUP returns a Symbol.
+ *
+ * @version last updated: 7/3/96
+ * @author Frank Flannery
+ */
+
+/* ****************************************************************
+ Class Symbol
+ what the parser expects to receive from the lexer.
+ the token is identified as follows:
+ sym: the symbol type
+ parse_state: the parse state.
+ value: is the lexical value of type Object
+ left : is the left position in the original input file
+ right: is the right position in the original input file
+ xleft: is the left position Object in the original input file
+ xright: is the left position Object in the original input file
+******************************************************************/
+
+public class Symbol {
+
+// TUM 20060327: Added new Constructor to provide more flexible way
+// for location handling
+/*******************************
+ *******************************/
+ public Symbol(int id, Symbol left, Symbol right, Object o){
+ this(id,left.left,right.right,o);
+ }
+ public Symbol(int id, Symbol left, Symbol right){
+ this(id,left.left,right.right);
+ }
+/*******************************
+ Constructor for l,r values
+ *******************************/
+
+ public Symbol(int id, int l, int r, Object o) {
+ this(id);
+ left = l;
+ right = r;
+ value = o;
+ }
+
+/*******************************
+ Constructor for no l,r values
+********************************/
+
+ public Symbol(int id, Object o) {
+ this(id, -1, -1, o);
+ }
+
+/*****************************
+ Constructor for no value
+ ***************************/
+
+ public Symbol(int id, int l, int r) {
+ this(id, l, r, null);
+ }
+
+/***********************************
+ Constructor for no value or l,r
+***********************************/
+
+ public Symbol(int sym_num) {
+ this(sym_num, -1);
+ left = -1;
+ right = -1;
+ }
+
+/***********************************
+ Constructor to give a start state
+***********************************/
+ Symbol(int sym_num, int state)
+ {
+ sym = sym_num;
+ parse_state = state;
+ }
+
+/*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/
+
+ /** The symbol number of the terminal or non terminal being represented */
+ public int sym;
+
+ /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/
+
+ /** The parse state to be recorded on the parse stack with this symbol.
+ * This field is for the convenience of the parser and shouldn't be
+ * modified except by the parser.
+ */
+ public int parse_state;
+ /** This allows us to catch some errors caused by scanners recycling
+ * symbols. For the use of the parser only. [CSA, 23-Jul-1999] */
+ boolean used_by_parser = false;
+
+/*******************************
+ The data passed to parser
+ *******************************/
+
+ public int left, right;
+ public Object value;
+
+ /*****************************
+ Printing this token out. (Override for pretty-print).
+ ****************************/
+ public String toString() { return "#"+sym; }
+}
+
+
+
+
+
+
Index: /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/src/java_cup/runtime/SymbolFactory.java
===================================================================
--- /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/src/java_cup/runtime/SymbolFactory.java (revision 25585)
+++ /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/src/java_cup/runtime/SymbolFactory.java (revision 25585)
@@ -0,0 +1,33 @@
+package java_cup.runtime;
+
+/**
+ * Creates the Symbols interface, which CUP uses as default
+ *
+ * @version last updated 27-03-2006
+ * @author Michael Petter
+ */
+
+/* *************************************************
+ Interface SymbolFactory
+
+ interface for creating new symbols
+ You can also use this interface for your own callback hooks
+ Declare Your own factory methods for creation of Objects in Your scanner!
+ ***************************************************/
+public interface SymbolFactory {
+ // Factory methods
+ /**
+ * Construction with left/right propagation switched on
+ */
+ public Symbol newSymbol(String name, int id, Symbol left, Symbol right, Object value);
+ public Symbol newSymbol(String name, int id, Symbol left, Symbol right);
+ /**
+ * Construction with left/right propagation switched off
+ */
+ public Symbol newSymbol(String name, int id, Object value);
+ public Symbol newSymbol(String name, int id);
+ /**
+ * Construction of start symbol
+ */
+ public Symbol startSymbol(String name, int id, int state);
+}
Index: /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/src/java_cup/runtime/lr_parser.java
===================================================================
--- /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/src/java_cup/runtime/lr_parser.java (revision 25585)
+++ /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/src/java_cup/runtime/lr_parser.java (revision 25585)
@@ -0,0 +1,1253 @@
+
+package java_cup.runtime;
+
+import java.util.Stack;
+
+/** This class implements a skeleton table driven LR parser. In general,
+ * LR parsers are a form of bottom up shift-reduce parsers. Shift-reduce
+ * parsers act by shifting input onto a parse stack until the Symbols
+ * matching the right hand side of a production appear on the top of the
+ * stack. Once this occurs, a reduce is performed. This involves removing
+ * the Symbols corresponding to the right hand side of the production
+ * (the so called "handle") and replacing them with the non-terminal from
+ * the left hand side of the production.
+ *
+ * To control the decision of whether to shift or reduce at any given point,
+ * the parser uses a state machine (the "viable prefix recognition machine"
+ * built by the parser generator). The current state of the machine is placed
+ * on top of the parse stack (stored as part of a Symbol object representing
+ * a terminal or non terminal). The parse action table is consulted
+ * (using the current state and the current lookahead Symbol as indexes) to
+ * determine whether to shift or to reduce. When the parser shifts, it
+ * changes to a new state by pushing a new Symbol (containing a new state)
+ * onto the stack. When the parser reduces, it pops the handle (right hand
+ * side of a production) off the stack. This leaves the parser in the state
+ * it was in before any of those Symbols were matched. Next the reduce-goto
+ * table is consulted (using the new state and current lookahead Symbol as
+ * indexes) to determine a new state to go to. The parser then shifts to
+ * this goto state by pushing the left hand side Symbol of the production
+ * (also containing the new state) onto the stack.
+ *
+ * This class actually provides four LR parsers. The methods parse() and
+ * debug_parse() provide two versions of the main parser (the only difference
+ * being that debug_parse() emits debugging trace messages as it parses).
+ * In addition to these main parsers, the error recovery mechanism uses two
+ * more. One of these is used to simulate "parsing ahead" in the input
+ * without carrying out actions (to verify that a potential error recovery
+ * has worked), and the other is used to parse through buffered "parse ahead"
+ * input in order to execute all actions and re-synchronize the actual parser
+ * configuration.
+ *
+ * This is an abstract class which is normally filled out by a subclass
+ * generated by the JavaCup parser generator. In addition to supplying
+ * the actual parse tables, generated code also supplies methods which
+ * invoke various pieces of user supplied code, provide access to certain
+ * special Symbols (e.g., EOF and error), etc. Specifically, the following
+ * abstract methods are normally supplied by generated code:
+ *
+ * - short[][] production_table()
+ *
- Provides a reference to the production table (indicating the index of
+ * the left hand side non terminal and the length of the right hand side
+ * for each production in the grammar).
+ *
- short[][] action_table()
+ *
- Provides a reference to the parse action table.
+ *
- short[][] reduce_table()
+ *
- Provides a reference to the reduce-goto table.
+ *
- int start_state()
+ *
- Indicates the index of the start state.
+ *
- int start_production()
+ *
- Indicates the index of the starting production.
+ *
- int EOF_sym()
+ *
- Indicates the index of the EOF Symbol.
+ *
- int error_sym()
+ *
- Indicates the index of the error Symbol.
+ *
- Symbol do_action()
+ *
- Executes a piece of user supplied action code. This always comes at
+ * the point of a reduce in the parse, so this code also allocates and
+ * fills in the left hand side non terminal Symbol object that is to be
+ * pushed onto the stack for the reduce.
+ *
- void init_actions()
+ *
- Code to initialize a special object that encapsulates user supplied
+ * actions (this object is used by do_action() to actually carry out the
+ * actions).
+ *
+ *
+ * In addition to these routines that must be supplied by the
+ * generated subclass there are also a series of routines that may
+ * be supplied. These include:
+ *
+ * - Symbol scan()
+ *
- Used to get the next input Symbol from the scanner.
+ *
- Scanner getScanner()
+ *
- Used to provide a scanner for the default implementation of
+ * scan().
+ *
- int error_sync_size()
+ *
- This determines how many Symbols past the point of an error
+ * must be parsed without error in order to consider a recovery to
+ * be valid. This defaults to 3. Values less than 2 are not
+ * recommended.
+ *
- void report_error(String message, Object info)
+ *
- This method is called to report an error. The default implementation
+ * simply prints a message to System.err and where the error occurred.
+ * This method is often replaced in order to provide a more sophisticated
+ * error reporting mechanism.
+ *
- void report_fatal_error(String message, Object info)
+ *
- This method is called when a fatal error that cannot be recovered from
+ * is encountered. In the default implementation, it calls
+ * report_error() to emit a message, then throws an exception.
+ *
- void syntax_error(Symbol cur_token)
+ *
- This method is called as soon as syntax error is detected (but
+ * before recovery is attempted). In the default implementation it
+ * invokes: report_error("Syntax error", null);
+ *
- void unrecovered_syntax_error(Symbol cur_token)
+ *
- This method is called if syntax error recovery fails. In the default
+ * implementation it invokes:
+ * report_fatal_error("Couldn't repair and continue parse", null);
+ *
+ *
+ * @see java_cup.runtime.Symbol
+ * @see java_cup.runtime.Symbol
+ * @see java_cup.runtime.virtual_parse_stack
+ * @version last updated: 7/3/96
+ * @author Frank Flannery
+ */
+
+public abstract class lr_parser {
+ /*-----------------------------------------------------------*/
+ /*--- Constructor(s) ----------------------------------------*/
+ /*-----------------------------------------------------------*/
+
+ /**
+ * Simple constructor.
+ */
+ public lr_parser() {
+ }
+
+ /**
+ * Constructor that sets the default scanner. [CSA/davidm]
+ */
+ public lr_parser(Scanner s) {
+ this(s,new DefaultSymbolFactory()); // TUM 20060327 old cup v10 Symbols as default
+ }
+ /**
+ * Constructor that sets the default scanner and a SymbolFactory
+ */
+ public lr_parser(Scanner s, SymbolFactory symfac) {
+ this(); // in case default constructor someday does something
+ symbolFactory = symfac;
+ setScanner(s);
+ }
+ public SymbolFactory symbolFactory;// = new DefaultSymbolFactory();
+ /**
+ * Whenever creation of a new Symbol is necessary, one should use this factory.
+ */
+ public SymbolFactory getSymbolFactory(){
+ return symbolFactory;
+ }
+ /*-----------------------------------------------------------*/
+ /*--- (Access to) Static (Class) Variables ------------------*/
+ /*-----------------------------------------------------------*/
+
+ /** The default number of Symbols after an error we much match to consider
+ * it recovered from.
+ */
+ protected final static int _error_sync_size = 3;
+
+ /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/
+
+ /** The number of Symbols after an error we much match to consider it
+ * recovered from.
+ */
+ protected int error_sync_size() {return _error_sync_size; }
+
+ /*-----------------------------------------------------------*/
+ /*--- (Access to) Instance Variables ------------------------*/
+ /*-----------------------------------------------------------*/
+
+ /** Table of production information (supplied by generated subclass).
+ * This table contains one entry per production and is indexed by
+ * the negative-encoded values (reduce actions) in the action_table.
+ * Each entry has two parts, the index of the non-terminal on the
+ * left hand side of the production, and the number of Symbols
+ * on the right hand side.
+ */
+ public abstract short[][] production_table();
+
+ /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/
+
+ /** The action table (supplied by generated subclass). This table is
+ * indexed by state and terminal number indicating what action is to
+ * be taken when the parser is in the given state (i.e., the given state
+ * is on top of the stack) and the given terminal is next on the input.
+ * States are indexed using the first dimension, however, the entries for
+ * a given state are compacted and stored in adjacent index, value pairs
+ * which are searched for rather than accessed directly (see get_action()).
+ * The actions stored in the table will be either shifts, reduces, or
+ * errors. Shifts are encoded as positive values (one greater than the
+ * state shifted to). Reduces are encoded as negative values (one less
+ * than the production reduced by). Error entries are denoted by zero.
+ *
+ * @see java_cup.runtime.lr_parser#get_action
+ */
+ public abstract short[][] action_table();
+
+ /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/
+
+ /** The reduce-goto table (supplied by generated subclass). This
+ * table is indexed by state and non-terminal number and contains
+ * state numbers. States are indexed using the first dimension, however,
+ * the entries for a given state are compacted and stored in adjacent
+ * index, value pairs which are searched for rather than accessed
+ * directly (see get_reduce()). When a reduce occurs, the handle
+ * (corresponding to the RHS of the matched production) is popped off
+ * the stack. The new top of stack indicates a state. This table is
+ * then indexed by that state and the LHS of the reducing production to
+ * indicate where to "shift" to.
+ *
+ * @see java_cup.runtime.lr_parser#get_reduce
+ */
+ public abstract short[][] reduce_table();
+
+ /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/
+
+ /** The index of the start state (supplied by generated subclass). */
+ public abstract int start_state();
+
+ /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/
+
+ /** The index of the start production (supplied by generated subclass). */
+ public abstract int start_production();
+
+ /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/
+
+ /** The index of the end of file terminal Symbol (supplied by generated
+ * subclass).
+ */
+ public abstract int EOF_sym();
+
+ /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/
+
+ /** The index of the special error Symbol (supplied by generated subclass). */
+ public abstract int error_sym();
+
+ /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/
+
+ /** Internal flag to indicate when parser should quit. */
+ protected boolean _done_parsing = false;
+
+ /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/
+
+ /** This method is called to indicate that the parser should quit. This is
+ * normally called by an accept action, but can be used to cancel parsing
+ * early in other circumstances if desired.
+ */
+ public void done_parsing()
+ {
+ _done_parsing = true;
+ }
+
+ /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/
+ /* Global parse state shared by parse(), error recovery, and
+ * debugging routines */
+ /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/
+
+ /** Indication of the index for top of stack (for use by actions). */
+ protected int tos;
+
+ /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/
+
+ /** The current lookahead Symbol. */
+ protected Symbol cur_token;
+
+ /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/
+
+ /** The parse stack itself. */
+ protected Stack stack = new Stack();
+
+ /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/
+
+ /** Direct reference to the production table. */
+ protected short[][] production_tab;
+
+ /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/
+
+ /** Direct reference to the action table. */
+ protected short[][] action_tab;
+
+ /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/
+
+ /** Direct reference to the reduce-goto table. */
+ protected short[][] reduce_tab;
+
+ /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/
+
+ /** This is the scanner object used by the default implementation
+ * of scan() to get Symbols. To avoid name conflicts with existing
+ * code, this field is private. [CSA/davidm] */
+ private Scanner _scanner;
+
+ /**
+ * Simple accessor method to set the default scanner.
+ */
+ public void setScanner(Scanner s) { _scanner = s; }
+
+ /**
+ * Simple accessor method to get the default scanner.
+ */
+ public Scanner getScanner() { return _scanner; }
+
+ /*-----------------------------------------------------------*/
+ /*--- General Methods ---------------------------------------*/
+ /*-----------------------------------------------------------*/
+
+ /** Perform a bit of user supplied action code (supplied by generated
+ * subclass). Actions are indexed by an internal action number assigned
+ * at parser generation time.
+ *
+ * @param act_num the internal index of the action to be performed.
+ * @param parser the parser object we are acting for.
+ * @param stack the parse stack of that object.
+ * @param top the index of the top element of the parse stack.
+ */
+ public abstract Symbol do_action(
+ int act_num,
+ lr_parser parser,
+ Stack stack,
+ int top)
+ throws java.lang.Exception;
+
+ /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/
+
+ /** User code for initialization inside the parser. Typically this
+ * initializes the scanner. This is called before the parser requests
+ * the first Symbol. Here this is just a placeholder for subclasses that
+ * might need this and we perform no action. This method is normally
+ * overridden by the generated code using this contents of the "init with"
+ * clause as its body.
+ */
+ public void user_init() throws java.lang.Exception { }
+
+ /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/
+
+ /** Initialize the action object. This is called before the parser does
+ * any parse actions. This is filled in by generated code to create
+ * an object that encapsulates all action code.
+ */
+ protected abstract void init_actions() throws java.lang.Exception;
+
+ /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/
+
+ /** Get the next Symbol from the input (supplied by generated subclass).
+ * Once end of file has been reached, all subsequent calls to scan
+ * should return an EOF Symbol (which is Symbol number 0). By default
+ * this method returns getScanner().next_token(); this implementation
+ * can be overriden by the generated parser using the code declared in
+ * the "scan with" clause. Do not recycle objects; every call to
+ * scan() should return a fresh object.
+ */
+ public Symbol scan() throws java.lang.Exception {
+ Symbol sym = getScanner().next_token();
+ return (sym!=null) ? sym : getSymbolFactory().newSymbol("END_OF_FILE",EOF_sym());
+ }
+
+ /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/
+
+ /** Report a fatal error. This method takes a message string and an
+ * additional object (to be used by specializations implemented in
+ * subclasses). Here in the base class a very simple implementation
+ * is provided which reports the error then throws an exception.
+ *
+ * @param message an error message.
+ * @param info an extra object reserved for use by specialized subclasses.
+ */
+ public void report_fatal_error(
+ String message,
+ Object info)
+ throws java.lang.Exception
+ {
+ /* stop parsing (not really necessary since we throw an exception, but) */
+ done_parsing();
+
+ /* use the normal error message reporting to put out the message */
+ report_error(message, info);
+
+ /* throw an exception */
+ throw new Exception("Can't recover from previous error(s)");
+ }
+
+ /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/
+
+ /** Report a non fatal error (or warning). This method takes a message
+ * string and an additional object (to be used by specializations
+ * implemented in subclasses). Here in the base class a very simple
+ * implementation is provided which simply prints the message to
+ * System.err.
+ *
+ * @param message an error message.
+ * @param info an extra object reserved for use by specialized subclasses.
+ */
+ public void report_error(String message, Object info)
+ {
+ System.err.print(message);
+ System.err.flush();
+ if (info instanceof Symbol)
+ if (((Symbol)info).left != -1)
+ System.err.println(" at character " + ((Symbol)info).left +
+ " of input");
+ else System.err.println("");
+ else System.err.println("");
+ }
+
+ /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/
+
+ /** This method is called when a syntax error has been detected and recovery
+ * is about to be invoked. Here in the base class we just emit a
+ * "Syntax error" error message.
+ *
+ * @param cur_token the current lookahead Symbol.
+ */
+ public void syntax_error(Symbol cur_token)
+ {
+ report_error("Syntax error", cur_token);
+ }
+
+ /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/
+
+ /** This method is called if it is determined that syntax error recovery
+ * has been unsuccessful. Here in the base class we report a fatal error.
+ *
+ * @param cur_token the current lookahead Symbol.
+ */
+ public void unrecovered_syntax_error(Symbol cur_token)
+ throws java.lang.Exception
+ {
+ report_fatal_error("Couldn't repair and continue parse", cur_token);
+ }
+
+ /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/
+
+ /** Fetch an action from the action table. The table is broken up into
+ * rows, one per state (rows are indexed directly by state number).
+ * Within each row, a list of index, value pairs are given (as sequential
+ * entries in the table), and the list is terminated by a default entry
+ * (denoted with a Symbol index of -1). To find the proper entry in a row
+ * we do a linear or binary search (depending on the size of the row).
+ *
+ * @param state the state index of the action being accessed.
+ * @param sym the Symbol index of the action being accessed.
+ */
+ protected final short get_action(int state, int sym)
+ {
+ short tag;
+ int first, last, probe;
+ short[] row = action_tab[state];
+
+ /* linear search if we are < 10 entries */
+ if (row.length < 20)
+ for (probe = 0; probe < row.length; probe++)
+ {
+ /* is this entry labeled with our Symbol or the default? */
+ tag = row[probe++];
+ if (tag == sym || tag == -1)
+ {
+ /* return the next entry */
+ return row[probe];
+ }
+ }
+ /* otherwise binary search */
+ else
+ {
+ first = 0;
+ last = (row.length-1)/2 - 1; /* leave out trailing default entry */
+ while (first <= last)
+ {
+ probe = (first+last)/2;
+ if (sym == row[probe*2])
+ return row[probe*2+1];
+ else if (sym > row[probe*2])
+ first = probe+1;
+ else
+ last = probe-1;
+ }
+
+ /* not found, use the default at the end */
+ return row[row.length-1];
+ }
+
+ /* shouldn't happened, but if we run off the end we return the
+ default (error == 0) */
+ return 0;
+ }
+
+ /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/
+
+ /** Fetch a state from the reduce-goto table. The table is broken up into
+ * rows, one per state (rows are indexed directly by state number).
+ * Within each row, a list of index, value pairs are given (as sequential
+ * entries in the table), and the list is terminated by a default entry
+ * (denoted with a Symbol index of -1). To find the proper entry in a row
+ * we do a linear search.
+ *
+ * @param state the state index of the entry being accessed.
+ * @param sym the Symbol index of the entry being accessed.
+ */
+ protected final short get_reduce(int state, int sym)
+ {
+ short tag;
+ short[] row = reduce_tab[state];
+
+ /* if we have a null row we go with the default */
+ if (row == null)
+ return -1;
+
+ for (int probe = 0; probe < row.length; probe++)
+ {
+ /* is this entry labeled with our Symbol or the default? */
+ tag = row[probe++];
+ if (tag == sym || tag == -1)
+ {
+ /* return the next entry */
+ return row[probe];
+ }
+ }
+ /* if we run off the end we return the default (error == -1) */
+ return -1;
+ }
+
+ /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/
+
+ /** This method provides the main parsing routine. It returns only when
+ * done_parsing() has been called (typically because the parser has
+ * accepted, or a fatal error has been reported). See the header
+ * documentation for the class regarding how shift/reduce parsers operate
+ * and how the various tables are used.
+ */
+ public Symbol parse() throws java.lang.Exception
+ {
+ /* the current action code */
+ int act;
+
+ /* the Symbol/stack element returned by a reduce */
+ Symbol lhs_sym = null;
+
+ /* information about production being reduced with */
+ short handle_size, lhs_sym_num;
+
+ /* set up direct reference to tables to drive the parser */
+
+ production_tab = production_table();
+ action_tab = action_table();
+ reduce_tab = reduce_table();
+
+ /* initialize the action encapsulation object */
+ init_actions();
+
+ /* do user initialization */
+ user_init();
+
+ /* get the first token */
+ cur_token = scan();
+
+ /* push dummy Symbol with start state to get us underway */
+ stack.removeAllElements();
+ stack.push(getSymbolFactory().startSymbol("START", 0, start_state()));
+ tos = 0;
+
+ /* continue until we are told to stop */
+ for (_done_parsing = false; !_done_parsing; )
+ {
+ /* Check current token for freshness. */
+ if (cur_token.used_by_parser)
+ throw new Error("Symbol recycling detected (fix your scanner).");
+
+ /* current state is always on the top of the stack */
+
+ /* look up action out of the current state with the current input */
+ act = get_action(((Symbol)stack.peek()).parse_state, cur_token.sym);
+
+ /* decode the action -- > 0 encodes shift */
+ if (act > 0)
+ {
+ /* shift to the encoded state by pushing it on the stack */
+ cur_token.parse_state = act-1;
+ cur_token.used_by_parser = true;
+ stack.push(cur_token);
+ tos++;
+
+ /* advance to the next Symbol */
+ cur_token = scan();
+ }
+ /* if its less than zero, then it encodes a reduce action */
+ else if (act < 0)
+ {
+ /* perform the action for the reduce */
+ lhs_sym = do_action((-act)-1, this, stack, tos);
+
+ /* look up information about the production */
+ lhs_sym_num = production_tab[(-act)-1][0];
+ handle_size = production_tab[(-act)-1][1];
+
+ /* pop the handle off the stack */
+ for (int i = 0; i < handle_size; i++)
+ {
+ stack.pop();
+ tos--;
+ }
+
+ /* look up the state to go to from the one popped back to */
+ act = get_reduce(((Symbol)stack.peek()).parse_state, lhs_sym_num);
+
+ /* shift to that state */
+ lhs_sym.parse_state = act;
+ lhs_sym.used_by_parser = true;
+ stack.push(lhs_sym);
+ tos++;
+ }
+ /* finally if the entry is zero, we have an error */
+ else if (act == 0)
+ {
+ /* call user syntax error reporting routine */
+ syntax_error(cur_token);
+
+ /* try to error recover */
+ if (!error_recovery(false))
+ {
+ /* if that fails give up with a fatal syntax error */
+ unrecovered_syntax_error(cur_token);
+
+ /* just in case that wasn't fatal enough, end parse */
+ done_parsing();
+ } else {
+ lhs_sym = (Symbol)stack.peek();
+ }
+ }
+ }
+ return lhs_sym;
+ }
+
+ /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/
+
+ /** Write a debugging message to System.err for the debugging version
+ * of the parser.
+ *
+ * @param mess the text of the debugging message.
+ */
+ public void debug_message(String mess)
+ {
+ System.err.println(mess);
+ }
+
+ /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/
+
+ /** Dump the parse stack for debugging purposes. */
+ public void dump_stack()
+ {
+ if (stack == null)
+ {
+ debug_message("# Stack dump requested, but stack is null");
+ return;
+ }
+
+ debug_message("============ Parse Stack Dump ============");
+
+ /* dump the stack */
+ for (int i=0; i");
+ if ((i%3)==2 || (i==(stack.size()-1))) {
+ debug_message(sb.toString());
+ sb = new StringBuffer(" ");
+ }
+ }
+ }
+
+ /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/
+
+ /** Perform a parse with debugging output. This does exactly the
+ * same things as parse(), except that it calls debug_shift() and
+ * debug_reduce() when shift and reduce moves are taken by the parser
+ * and produces various other debugging messages.
+ */
+ public Symbol debug_parse()
+ throws java.lang.Exception
+ {
+ /* the current action code */
+ int act;
+
+ /* the Symbol/stack element returned by a reduce */
+ Symbol lhs_sym = null;
+
+ /* information about production being reduced with */
+ short handle_size, lhs_sym_num;
+
+ /* set up direct reference to tables to drive the parser */
+ production_tab = production_table();
+ action_tab = action_table();
+ reduce_tab = reduce_table();
+
+ debug_message("# Initializing parser");
+
+ /* initialize the action encapsulation object */
+ init_actions();
+
+ /* do user initialization */
+ user_init();
+
+ /* the current Symbol */
+ cur_token = scan();
+
+ debug_message("# Current Symbol is #" + cur_token.sym);
+
+ /* push dummy Symbol with start state to get us underway */
+ stack.removeAllElements();
+ stack.push(getSymbolFactory().startSymbol("START",0, start_state()));
+ tos = 0;
+
+ /* continue until we are told to stop */
+ for (_done_parsing = false; !_done_parsing; )
+ {
+ /* Check current token for freshness. */
+ if (cur_token.used_by_parser)
+ throw new Error("Symbol recycling detected (fix your scanner).");
+
+ /* current state is always on the top of the stack */
+ //debug_stack();
+
+ /* look up action out of the current state with the current input */
+ act = get_action(((Symbol)stack.peek()).parse_state, cur_token.sym);
+
+ /* decode the action -- > 0 encodes shift */
+ if (act > 0)
+ {
+ /* shift to the encoded state by pushing it on the stack */
+ cur_token.parse_state = act-1;
+ cur_token.used_by_parser = true;
+ debug_shift(cur_token);
+ stack.push(cur_token);
+ tos++;
+
+ /* advance to the next Symbol */
+ cur_token = scan();
+ debug_message("# Current token is " + cur_token);
+ }
+ /* if its less than zero, then it encodes a reduce action */
+ else if (act < 0)
+ {
+ /* perform the action for the reduce */
+ lhs_sym = do_action((-act)-1, this, stack, tos);
+
+ /* look up information about the production */
+ lhs_sym_num = production_tab[(-act)-1][0];
+ handle_size = production_tab[(-act)-1][1];
+
+ debug_reduce((-act)-1, lhs_sym_num, handle_size);
+
+ /* pop the handle off the stack */
+ for (int i = 0; i < handle_size; i++)
+ {
+ stack.pop();
+ tos--;
+ }
+
+ /* look up the state to go to from the one popped back to */
+ act = get_reduce(((Symbol)stack.peek()).parse_state, lhs_sym_num);
+ debug_message("# Reduce rule: top state " +
+ ((Symbol)stack.peek()).parse_state +
+ ", lhs sym " + lhs_sym_num + " -> state " + act);
+
+ /* shift to that state */
+ lhs_sym.parse_state = act;
+ lhs_sym.used_by_parser = true;
+ stack.push(lhs_sym);
+ tos++;
+
+ debug_message("# Goto state #" + act);
+ }
+ /* finally if the entry is zero, we have an error */
+ else if (act == 0)
+ {
+ /* call user syntax error reporting routine */
+ syntax_error(cur_token);
+
+ /* try to error recover */
+ if (!error_recovery(true))
+ {
+ /* if that fails give up with a fatal syntax error */
+ unrecovered_syntax_error(cur_token);
+
+ /* just in case that wasn't fatal enough, end parse */
+ done_parsing();
+ } else {
+ lhs_sym = (Symbol)stack.peek();
+ }
+ }
+ }
+ return lhs_sym;
+ }
+
+ /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/
+ /* Error recovery code */
+ /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/
+
+ /** Attempt to recover from a syntax error. This returns false if recovery
+ * fails, true if it succeeds. Recovery happens in 4 steps. First we
+ * pop the parse stack down to a point at which we have a shift out
+ * of the top-most state on the error Symbol. This represents the
+ * initial error recovery configuration. If no such configuration is
+ * found, then we fail. Next a small number of "lookahead" or "parse
+ * ahead" Symbols are read into a buffer. The size of this buffer is
+ * determined by error_sync_size() and determines how many Symbols beyond
+ * the error must be matched to consider the recovery a success. Next,
+ * we begin to discard Symbols in attempt to get past the point of error
+ * to a point where we can continue parsing. After each Symbol, we attempt
+ * to "parse ahead" though the buffered lookahead Symbols. The "parse ahead"
+ * process simulates that actual parse, but does not modify the real
+ * parser's configuration, nor execute any actions. If we can parse all
+ * the stored Symbols without error, then the recovery is considered a
+ * success. Once a successful recovery point is determined, we do an
+ * actual parse over the stored input -- modifying the real parse
+ * configuration and executing all actions. Finally, we return the the
+ * normal parser to continue with the overall parse.
+ *
+ * @param debug should we produce debugging messages as we parse.
+ */
+ protected boolean error_recovery(boolean debug)
+ throws java.lang.Exception
+ {
+ if (debug) debug_message("# Attempting error recovery");
+
+ /* first pop the stack back into a state that can shift on error and
+ do that shift (if that fails, we fail) */
+ if (!find_recovery_config(debug))
+ {
+ if (debug) debug_message("# Error recovery fails");
+ return false;
+ }
+
+ /* read ahead to create lookahead we can parse multiple times */
+ read_lookahead();
+
+ /* repeatedly try to parse forward until we make it the required dist */
+ for (;;)
+ {
+ /* try to parse forward, if it makes it, bail out of loop */
+ if (debug) debug_message("# Trying to parse ahead");
+ if (try_parse_ahead(debug))
+ {
+ break;
+ }
+
+ /* if we are now at EOF, we have failed */
+ if (lookahead[0].sym == EOF_sym())
+ {
+ if (debug) debug_message("# Error recovery fails at EOF");
+ return false;
+ }
+
+ /* otherwise, we consume another Symbol and try again */
+ // BUG FIX by Bruce Hutton
+ // Computer Science Department, University of Auckland,
+ // Auckland, New Zealand.
+ // It is the first token that is being consumed, not the one
+ // we were up to parsing
+ if (debug)
+ debug_message("# Consuming Symbol #" + lookahead[ 0 ].sym);
+ restart_lookahead();
+ }
+
+ /* we have consumed to a point where we can parse forward */
+ if (debug) debug_message("# Parse-ahead ok, going back to normal parse");
+
+ /* do the real parse (including actions) across the lookahead */
+ parse_lookahead(debug);
+
+ /* we have success */
+ return true;
+ }
+
+ /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/
+
+ /** Determine if we can shift under the special error Symbol out of the
+ * state currently on the top of the (real) parse stack.
+ */
+ protected boolean shift_under_error()
+ {
+ /* is there a shift under error Symbol */
+ return get_action(((Symbol)stack.peek()).parse_state, error_sym()) > 0;
+ }
+
+ /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/
+
+ /** Put the (real) parse stack into error recovery configuration by
+ * popping the stack down to a state that can shift on the special
+ * error Symbol, then doing the shift. If no suitable state exists on
+ * the stack we return false
+ *
+ * @param debug should we produce debugging messages as we parse.
+ */
+ protected boolean find_recovery_config(boolean debug)
+ {
+ Symbol error_token;
+ int act;
+
+ if (debug) debug_message("# Finding recovery state on stack");
+
+ /* Remember the right-position of the top symbol on the stack */
+ Symbol right = ((Symbol)stack.peek());// TUM 20060327 removed .right
+ Symbol left = right;// TUM 20060327 removed .left
+
+ /* pop down until we can shift under error Symbol */
+ while (!shift_under_error())
+ {
+ /* pop the stack */
+ if (debug)
+ debug_message("# Pop stack by one, state was # " +
+ ((Symbol)stack.peek()).parse_state);
+ left = ((Symbol)stack.pop()); // TUM 20060327 removed .left
+ tos--;
+
+ /* if we have hit bottom, we fail */
+ if (stack.empty())
+ {
+ if (debug) debug_message("# No recovery state found on stack");
+ return false;
+ }
+ }
+
+ /* state on top of the stack can shift under error, find the shift */
+ act = get_action(((Symbol)stack.peek()).parse_state, error_sym());
+ if (debug)
+ {
+ debug_message("# Recover state found (#" +
+ ((Symbol)stack.peek()).parse_state + ")");
+ debug_message("# Shifting on error to state #" + (act-1));
+ }
+
+ /* build and shift a special error Symbol */
+ error_token = getSymbolFactory().newSymbol("ERROR",error_sym(), left, right);
+ error_token.parse_state = act-1;
+ error_token.used_by_parser = true;
+ stack.push(error_token);
+ tos++;
+
+ return true;
+ }
+
+ /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/
+
+ /** Lookahead Symbols used for attempting error recovery "parse aheads". */
+ protected Symbol lookahead[];
+
+ /** Position in lookahead input buffer used for "parse ahead". */
+ protected int lookahead_pos;
+
+ /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/
+
+ /** Read from input to establish our buffer of "parse ahead" lookahead
+ * Symbols.
+ */
+ protected void read_lookahead() throws java.lang.Exception
+ {
+ /* create the lookahead array */
+ lookahead = new Symbol[error_sync_size()];
+
+ /* fill in the array */
+ for (int i = 0; i < error_sync_size(); i++)
+ {
+ lookahead[i] = cur_token;
+ cur_token = scan();
+ }
+
+ /* start at the beginning */
+ lookahead_pos = 0;
+ }
+
+ /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/
+
+ /** Return the current lookahead in our error "parse ahead" buffer. */
+ protected Symbol cur_err_token() { return lookahead[lookahead_pos]; }
+
+ /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/
+
+ /** Advance to next "parse ahead" input Symbol. Return true if we have
+ * input to advance to, false otherwise.
+ */
+ protected boolean advance_lookahead()
+ {
+ /* advance the input location */
+ lookahead_pos++;
+
+ /* return true if we didn't go off the end */
+ return lookahead_pos < error_sync_size();
+ }
+
+ /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/
+
+ /** Reset the parse ahead input to one Symbol past where we started error
+ * recovery (this consumes one new Symbol from the real input).
+ */
+ protected void restart_lookahead() throws java.lang.Exception
+ {
+ /* move all the existing input over */
+ for (int i = 1; i < error_sync_size(); i++)
+ lookahead[i-1] = lookahead[i];
+
+ /* read a new Symbol into the last spot */
+ // BUG Fix by Bruce Hutton
+ // Computer Science Department, University of Auckland,
+ // Auckland, New Zealand. [applied 5-sep-1999 by csa]
+ // The following two lines were out of order!!
+ lookahead[error_sync_size()-1] = cur_token;
+ cur_token = scan();
+
+ /* reset our internal position marker */
+ lookahead_pos = 0;
+ }
+
+ /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/
+
+ /** Do a simulated parse forward (a "parse ahead") from the current
+ * stack configuration using stored lookahead input and a virtual parse
+ * stack. Return true if we make it all the way through the stored
+ * lookahead input without error. This basically simulates the action of
+ * parse() using only our saved "parse ahead" input, and not executing any
+ * actions.
+ *
+ * @param debug should we produce debugging messages as we parse.
+ */
+ protected boolean try_parse_ahead(boolean debug)
+ throws java.lang.Exception
+ {
+ int act;
+ short lhs, rhs_size;
+
+ /* create a virtual stack from the real parse stack */
+ virtual_parse_stack vstack = new virtual_parse_stack(stack);
+
+ /* parse until we fail or get past the lookahead input */
+ for (;;)
+ {
+ /* look up the action from the current state (on top of stack) */
+ act = get_action(vstack.top(), cur_err_token().sym);
+
+ /* if its an error, we fail */
+ if (act == 0) return false;
+
+ /* > 0 encodes a shift */
+ if (act > 0)
+ {
+ /* push the new state on the stack */
+ vstack.push(act-1);
+
+ if (debug) debug_message("# Parse-ahead shifts Symbol #" +
+ cur_err_token().sym + " into state #" + (act-1));
+
+ /* advance simulated input, if we run off the end, we are done */
+ if (!advance_lookahead()) return true;
+ }
+ /* < 0 encodes a reduce */
+ else
+ {
+ /* if this is a reduce with the start production we are done */
+ if ((-act)-1 == start_production())
+ {
+ if (debug) debug_message("# Parse-ahead accepts");
+ return true;
+ }
+
+ /* get the lhs Symbol and the rhs size */
+ lhs = production_tab[(-act)-1][0];
+ rhs_size = production_tab[(-act)-1][1];
+
+ /* pop handle off the stack */
+ for (int i = 0; i < rhs_size; i++)
+ vstack.pop();
+
+ if (debug)
+ debug_message("# Parse-ahead reduces: handle size = " +
+ rhs_size + " lhs = #" + lhs + " from state #" + vstack.top());
+
+ /* look up goto and push it onto the stack */
+ vstack.push(get_reduce(vstack.top(), lhs));
+ if (debug)
+ debug_message("# Goto state #" + vstack.top());
+ }
+ }
+ }
+
+ /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/
+
+ /** Parse forward using stored lookahead Symbols. In this case we have
+ * already verified that parsing will make it through the stored lookahead
+ * Symbols and we are now getting back to the point at which we can hand
+ * control back to the normal parser. Consequently, this version of the
+ * parser performs all actions and modifies the real parse configuration.
+ * This returns once we have consumed all the stored input or we accept.
+ *
+ * @param debug should we produce debugging messages as we parse.
+ */
+ protected void parse_lookahead(boolean debug)
+ throws java.lang.Exception
+ {
+ /* the current action code */
+ int act;
+
+ /* the Symbol/stack element returned by a reduce */
+ Symbol lhs_sym = null;
+
+ /* information about production being reduced with */
+ short handle_size, lhs_sym_num;
+
+ /* restart the saved input at the beginning */
+ lookahead_pos = 0;
+
+ if (debug)
+ {
+ debug_message("# Reparsing saved input with actions");
+ debug_message("# Current Symbol is #" + cur_err_token().sym);
+ debug_message("# Current state is #" +
+ ((Symbol)stack.peek()).parse_state);
+ }
+
+ /* continue until we accept or have read all lookahead input */
+ while(!_done_parsing)
+ {
+ /* current state is always on the top of the stack */
+
+ /* look up action out of the current state with the current input */
+ act =
+ get_action(((Symbol)stack.peek()).parse_state, cur_err_token().sym);
+
+ /* decode the action -- > 0 encodes shift */
+ if (act > 0)
+ {
+ /* shift to the encoded state by pushing it on the stack */
+ cur_err_token().parse_state = act-1;
+ cur_err_token().used_by_parser = true;
+ if (debug) debug_shift(cur_err_token());
+ stack.push(cur_err_token());
+ tos++;
+
+ /* advance to the next Symbol, if there is none, we are done */
+ if (!advance_lookahead())
+ {
+ if (debug) debug_message("# Completed reparse");
+
+ /* scan next Symbol so we can continue parse */
+ // BUGFIX by Chris Harris :
+ // correct a one-off error by commenting out
+ // this next line.
+ /*cur_token = scan();*/
+
+ /* go back to normal parser */
+ return;
+ }
+
+ if (debug)
+ debug_message("# Current Symbol is #" + cur_err_token().sym);
+ }
+ /* if its less than zero, then it encodes a reduce action */
+ else if (act < 0)
+ {
+ /* perform the action for the reduce */
+ lhs_sym = do_action((-act)-1, this, stack, tos);
+
+ /* look up information about the production */
+ lhs_sym_num = production_tab[(-act)-1][0];
+ handle_size = production_tab[(-act)-1][1];
+
+ if (debug) debug_reduce((-act)-1, lhs_sym_num, handle_size);
+
+ /* pop the handle off the stack */
+ for (int i = 0; i < handle_size; i++)
+ {
+ stack.pop();
+ tos--;
+ }
+
+ /* look up the state to go to from the one popped back to */
+ act = get_reduce(((Symbol)stack.peek()).parse_state, lhs_sym_num);
+
+ /* shift to that state */
+ lhs_sym.parse_state = act;
+ lhs_sym.used_by_parser = true;
+ stack.push(lhs_sym);
+ tos++;
+
+ if (debug) debug_message("# Goto state #" + act);
+
+ }
+ /* finally if the entry is zero, we have an error
+ (shouldn't happen here, but...)*/
+ else if (act == 0)
+ {
+ report_fatal_error("Syntax error", lhs_sym);
+ return;
+ }
+ }
+
+
+ }
+
+ /*-----------------------------------------------------------*/
+
+ /** Utility function: unpacks parse tables from strings */
+ protected static short[][] unpackFromStrings(String[] sa)
+ {
+ // Concatanate initialization strings.
+ StringBuffer sb = new StringBuffer(sa[0]);
+ for (int i=1; i= real_stack.size()) return;
+
+ /* get a copy of the first Symbol we have not transfered */
+ stack_sym = (Symbol)real_stack.elementAt(real_stack.size()-1-real_next);
+
+ /* record the transfer */
+ real_next++;
+
+ /* put the state number from the Symbol onto the virtual stack */
+ vstack.push(new Integer(stack_sym.parse_state));
+ }
+
+ /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/
+
+ /** Indicate whether the stack is empty. */
+ public boolean empty()
+ {
+ /* if vstack is empty then we were unable to transfer onto it and
+ the whole thing is empty. */
+ return vstack.empty();
+ }
+
+ /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/
+
+ /** Return value on the top of the stack (without popping it). */
+ public int top() throws java.lang.Exception
+ {
+ if (vstack.empty())
+ throw new Exception(
+ "Internal parser error: top() called on empty virtual stack");
+
+ return ((Integer)vstack.peek()).intValue();
+ }
+
+ /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/
+
+ /** Pop the stack. */
+ public void pop() throws java.lang.Exception
+ {
+ if (vstack.empty())
+ throw new Exception(
+ "Internal parser error: pop from empty virtual stack");
+
+ /* pop it */
+ vstack.pop();
+
+ /* if we are now empty transfer an element (if there is one) */
+ if (vstack.empty())
+ get_from_real();
+ }
+
+ /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/
+
+ /** Push a state number onto the stack. */
+ public void push(int state_num)
+ {
+ vstack.push(new Integer(state_num));
+ }
+
+ /*-----------------------------------------------------------*/
+
+}
Index: /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/src/manifest
===================================================================
--- /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/src/manifest (revision 25585)
+++ /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/src/manifest (revision 25585)
@@ -0,0 +1,1 @@
+Main-Class: JFlex.Main
Index: /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/src/skeleton.default
===================================================================
--- /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/src/skeleton.default (revision 25585)
+++ /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/src/skeleton.default (revision 25585)
@@ -0,0 +1,327 @@
+
+ /** This character denotes the end of file */
+ public static final int YYEOF = -1;
+
+ /** initial size of the lookahead buffer */
+--- private static final int ZZ_BUFFERSIZE = ...;
+
+ /** lexical states */
+--- lexical states, charmap
+
+ /* error codes */
+ private static final int ZZ_UNKNOWN_ERROR = 0;
+ private static final int ZZ_NO_MATCH = 1;
+ private static final int ZZ_PUSHBACK_2BIG = 2;
+
+ /* error messages for the codes above */
+ private static final String ZZ_ERROR_MSG[] = {
+ "Unkown internal scanner error",
+ "Error: could not match input",
+ "Error: pushback value was too large"
+ };
+
+--- isFinal list
+ /** the input device */
+ private java.io.Reader zzReader;
+
+ /** the current state of the DFA */
+ private int zzState;
+
+ /** the current lexical state */
+ private int zzLexicalState = YYINITIAL;
+
+ /** this buffer contains the current text to be matched and is
+ the source of the yytext() string */
+ private char zzBuffer[] = new char[ZZ_BUFFERSIZE];
+
+ /** the textposition at the last accepting state */
+ private int zzMarkedPos;
+
+ /** the current text position in the buffer */
+ private int zzCurrentPos;
+
+ /** startRead marks the beginning of the yytext() string in the buffer */
+ private int zzStartRead;
+
+ /** endRead marks the last character in the buffer, that has been read
+ from input */
+ private int zzEndRead;
+
+ /** number of newlines encountered up to the start of the matched text */
+ private int yyline;
+
+ /** the number of characters up to the start of the matched text */
+ private int yychar;
+
+ /**
+ * the number of characters from the last newline up to the start of the
+ * matched text
+ */
+ private int yycolumn;
+
+ /**
+ * zzAtBOL == true <=> the scanner is currently at the beginning of a line
+ */
+ private boolean zzAtBOL = true;
+
+ /** zzAtEOF == true <=> the scanner is at the EOF */
+ private boolean zzAtEOF;
+
+ /** denotes if the user-EOF-code has already been executed */
+ private boolean zzEOFDone;
+
+--- user class code
+
+ /**
+ * Creates a new scanner
+ * There is also a java.io.InputStream version of this constructor.
+ *
+ * @param in the java.io.Reader to read input from.
+ */
+--- constructor declaration
+
+
+ /**
+ * Refills the input buffer.
+ *
+ * @return false
, iff there was new input.
+ *
+ * @exception java.io.IOException if any I/O-Error occurs
+ */
+ private boolean zzRefill() throws java.io.IOException {
+
+ /* first: make room (if you can) */
+ if (zzStartRead > 0) {
+ System.arraycopy(zzBuffer, zzStartRead,
+ zzBuffer, 0,
+ zzEndRead-zzStartRead);
+
+ /* translate stored positions */
+ zzEndRead-= zzStartRead;
+ zzCurrentPos-= zzStartRead;
+ zzMarkedPos-= zzStartRead;
+ zzStartRead = 0;
+ }
+
+ /* is the buffer big enough? */
+ if (zzCurrentPos >= zzBuffer.length) {
+ /* if not: blow it up */
+ char newBuffer[] = new char[zzCurrentPos*2];
+ System.arraycopy(zzBuffer, 0, newBuffer, 0, zzBuffer.length);
+ zzBuffer = newBuffer;
+ }
+
+ /* finally: fill the buffer with new input */
+ int numRead = zzReader.read(zzBuffer, zzEndRead,
+ zzBuffer.length-zzEndRead);
+
+ if (numRead > 0) {
+ zzEndRead+= numRead;
+ return false;
+ }
+ // unlikely but not impossible: read 0 characters, but not at end of stream
+ if (numRead == 0) {
+ int c = zzReader.read();
+ if (c == -1) {
+ return true;
+ } else {
+ zzBuffer[zzEndRead++] = (char) c;
+ return false;
+ }
+ }
+
+ // numRead < 0
+ return true;
+ }
+
+
+ /**
+ * Closes the input stream.
+ */
+ public final void yyclose() throws java.io.IOException {
+ zzAtEOF = true; /* indicate end of file */
+ zzEndRead = zzStartRead; /* invalidate buffer */
+
+ if (zzReader != null)
+ zzReader.close();
+ }
+
+
+ /**
+ * Resets the scanner to read from a new input stream.
+ * Does not close the old reader.
+ *
+ * All internal variables are reset, the old input stream
+ * cannot be reused (internal buffer is discarded and lost).
+ * Lexical state is set to ZZ_INITIAL.
+ *
+ * @param reader the new input stream
+ */
+ public final void yyreset(java.io.Reader reader) {
+ zzReader = reader;
+ zzAtBOL = true;
+ zzAtEOF = false;
+ zzEOFDone = false;
+ zzEndRead = zzStartRead = 0;
+ zzCurrentPos = zzMarkedPos = 0;
+ yyline = yychar = yycolumn = 0;
+ zzLexicalState = YYINITIAL;
+ }
+
+
+ /**
+ * Returns the current lexical state.
+ */
+ public final int yystate() {
+ return zzLexicalState;
+ }
+
+
+ /**
+ * Enters a new lexical state
+ *
+ * @param newState the new lexical state
+ */
+ public final void yybegin(int newState) {
+ zzLexicalState = newState;
+ }
+
+
+ /**
+ * Returns the text matched by the current regular expression.
+ */
+ public final String yytext() {
+ return new String( zzBuffer, zzStartRead, zzMarkedPos-zzStartRead );
+ }
+
+
+ /**
+ * Returns the character at position pos from the
+ * matched text.
+ *
+ * It is equivalent to yytext().charAt(pos), but faster
+ *
+ * @param pos the position of the character to fetch.
+ * A value from 0 to yylength()-1.
+ *
+ * @return the character at position pos
+ */
+ public final char yycharat(int pos) {
+ return zzBuffer[zzStartRead+pos];
+ }
+
+
+ /**
+ * Returns the length of the matched text region.
+ */
+ public final int yylength() {
+ return zzMarkedPos-zzStartRead;
+ }
+
+
+ /**
+ * Reports an error that occured while scanning.
+ *
+ * In a wellformed scanner (no or only correct usage of
+ * yypushback(int) and a match-all fallback rule) this method
+ * will only be called with things that "Can't Possibly Happen".
+ * If this method is called, something is seriously wrong
+ * (e.g. a JFlex bug producing a faulty scanner etc.).
+ *
+ * Usual syntax/scanner level error handling should be done
+ * in error fallback rules.
+ *
+ * @param errorCode the code of the errormessage to display
+ */
+--- zzScanError declaration
+ String message;
+ try {
+ message = ZZ_ERROR_MSG[errorCode];
+ }
+ catch (ArrayIndexOutOfBoundsException e) {
+ message = ZZ_ERROR_MSG[ZZ_UNKNOWN_ERROR];
+ }
+
+--- throws clause
+ }
+
+
+ /**
+ * Pushes the specified amount of characters back into the input stream.
+ *
+ * They will be read again by then next call of the scanning method
+ *
+ * @param number the number of characters to be read again.
+ * This number must not be greater than yylength()!
+ */
+--- yypushback decl (contains zzScanError exception)
+ if ( number > yylength() )
+ zzScanError(ZZ_PUSHBACK_2BIG);
+
+ zzMarkedPos -= number;
+ }
+
+
+--- zzDoEOF
+ /**
+ * Resumes scanning until the next regular expression is matched,
+ * the end of input is encountered or an I/O-Error occurs.
+ *
+ * @return the next token
+ * @exception java.io.IOException if any I/O-Error occurs
+ */
+--- yylex declaration
+ int zzInput;
+ int zzAction;
+
+ // cached fields:
+ int zzCurrentPosL;
+ int zzMarkedPosL;
+ int zzEndReadL = zzEndRead;
+ char [] zzBufferL = zzBuffer;
+ char [] zzCMapL = ZZ_CMAP;
+
+--- local declarations
+
+ while (true) {
+ zzMarkedPosL = zzMarkedPos;
+
+--- start admin (line, char, col count)
+ zzAction = -1;
+
+ zzCurrentPosL = zzCurrentPos = zzStartRead = zzMarkedPosL;
+
+--- start admin (lexstate etc)
+
+ zzForAction: {
+ while (true) {
+
+--- next input, line, col, char count, next transition, isFinal action
+ zzAction = zzState;
+ zzMarkedPosL = zzCurrentPosL;
+--- line count update
+ }
+
+ }
+ }
+
+ // store back cached position
+ zzMarkedPos = zzMarkedPosL;
+--- char count update
+
+--- actions
+ default:
+ if (zzInput == YYEOF && zzStartRead == zzCurrentPos) {
+ zzAtEOF = true;
+--- eofvalue
+ }
+ else {
+--- no match
+ }
+ }
+ }
+ }
+
+--- main
+
+}
Index: /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/src/skeleton.nested
===================================================================
--- /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/src/skeleton.nested (revision 25585)
+++ /other-projects/gli-rsyntax-textarea/devel-packages/jflex-1.4.3/src/skeleton.nested (revision 25585)
@@ -0,0 +1,428 @@
+
+ /** This character denotes the end of file */
+ public static final int YYEOF = -1;
+
+ /** initial size of the lookahead buffer */
+--- private static final int ZZ_BUFFERSIZE = ...;
+
+ /** lexical states */
+--- lexical states, charmap
+
+ /* error codes */
+ private static final int ZZ_UNKNOWN_ERROR = 0;
+ private static final int ZZ_NO_MATCH = 1;
+ private static final int ZZ_PUSHBACK_2BIG = 2;
+
+ /* error messages for the codes above */
+ private static final String ZZ_ERROR_MSG[] = {
+ "Unkown internal scanner error",
+ "Error: could not match input",
+ "Error: pushback value was too large"
+ };
+
+--- isFinal list
+ /** the input device */
+ private java.io.Reader zzReader;
+
+ /** the current state of the DFA */
+ private int zzState;
+
+ /** the current lexical state */
+ private int zzLexicalState = YYINITIAL;
+
+ /** this buffer contains the current text to be matched and is
+ the source of the yytext() string */
+ private char zzBuffer[] = new char[ZZ_BUFFERSIZE];
+
+ /** the textposition at the last accepting state */
+ private int zzMarkedPos;
+
+ /** the current text position in the buffer */
+ private int zzCurrentPos;
+
+ /** startRead marks the beginning of the yytext() string in the buffer */
+ private int zzStartRead;
+
+ /** endRead marks the last character in the buffer, that has been read
+ from input */
+ private int zzEndRead;
+
+ /** number of newlines encountered up to the start of the matched text */
+ private int yyline;
+
+ /** the number of characters up to the start of the matched text */
+ private int yychar;
+
+ /**
+ * the number of characters from the last newline up to the start of the
+ * matched text
+ */
+ private int yycolumn;
+
+ /**
+ * zzAtBOL == true <=> the scanner is currently at the beginning of a line
+ */
+ private boolean zzAtBOL = true;
+
+ /** zzAtEOF == true <=> the scanner is at the EOF */
+ private boolean zzAtEOF;
+
+ /** denotes if the user-EOF-code has already been executed */
+ private boolean zzEOFDone;
+
+ /** the stack of open (nested) input streams to read from */
+ private java.util.Stack zzStreams = new java.util.Stack();
+
+ /**
+ * inner class used to store info for nested
+ * input streams
+ */
+ private static final class ZzFlexStreamInfo {
+ java.io.Reader zzReader;
+ int zzEndRead;
+ int zzStartRead;
+ int zzCurrentPos;
+ int zzMarkedPos;
+ int yyline;
+ int yycolumn;
+ char [] zzBuffer;
+ boolean zzAtEOF;
+ boolean zzEOFDone;
+
+ /** sets all values stored in this class */
+ ZzFlexStreamInfo(java.io.Reader zzReader, int zzEndRead, int zzStartRead,
+ int zzCurrentPos, int zzMarkedPos,
+ char [] zzBuffer, boolean zzAtEOF, int yyline, int yycolumn) {
+ this.zzReader = zzReader;
+ this.zzEndRead = zzEndRead;
+ this.zzStartRead = zzStartRead;
+ this.zzCurrentPos = zzCurrentPos;
+ this.zzMarkedPos = zzMarkedPos;
+ this.zzBuffer = zzBuffer;
+ this.zzAtEOF = zzAtEOF;
+ this.zzEOFDone = zzEOFDone;
+ this.yyline = yyline;
+ this.yycolumn = yycolumn;
+ }
+ }
+
+--- user class code
+
+ /**
+ * Creates a new scanner
+ * There is also a java.io.InputStream version of this constructor.
+ *
+ * @param in the java.io.Reader to read input from.
+ */
+--- constructor declaration
+
+
+ /**
+ * Refills the input buffer.
+ *
+ * @return false
, iff there was new input.
+ *
+ * @exception java.io.IOException if any I/O-Error occurs
+ */
+ private boolean zzRefill() throws java.io.IOException {
+
+ /* first: make room (if you can) */
+ if (zzStartRead > 0) {
+ System.arraycopy(zzBuffer, zzStartRead,
+ zzBuffer, 0,
+ zzEndRead-zzStartRead);
+
+ /* translate stored positions */
+ zzEndRead-= zzStartRead;
+ zzCurrentPos-= zzStartRead;
+ zzMarkedPos-= zzStartRead;
+ zzStartRead = 0;
+ }
+
+ /* is the buffer big enough? */
+ if (zzCurrentPos >= zzBuffer.length) {
+ /* if not: blow it up */
+ char newBuffer[] = new char[zzCurrentPos*2];
+ System.arraycopy(zzBuffer, 0, newBuffer, 0, zzBuffer.length);
+ zzBuffer = newBuffer;
+ }
+
+ /* finally: fill the buffer with new input */
+ int numRead = zzReader.read(zzBuffer, zzEndRead,
+ zzBuffer.length-zzEndRead);
+
+ if (numRead > 0) {
+ zzEndRead+= numRead;
+ return false;
+ }
+ // unlikely but not impossible: read 0 characters, but not at end of stream
+ if (numRead == 0) {
+ int c = zzReader.read();
+ if (c == -1) {
+ return true;
+ } else {
+ zzBuffer[zzEndRead++] = (char) c;
+ return false;
+ }
+ }
+
+ // numRead < 0)
+ return true;
+ }
+
+
+ /**
+ * Closes the input stream.
+ */
+ public final void yyclose() throws java.io.IOException {
+ zzAtEOF = true; /* indicate end of file */
+ zzEndRead = zzStartRead; /* invalidate buffer */
+
+ if (zzReader != null)
+ zzReader.close();
+ }
+
+
+ /**
+ * Stores the current input stream on a stack, and
+ * reads from a new stream. Lexical state, line,
+ * char, and column counting remain untouched.
+ *
+ * The current input stream can be restored with
+ * yypopstream (usually in an <> action).
+ *
+ * @param reader the new input stream to read from
+ *
+ * @see #yypopStream()
+ */
+ public final void yypushStream(java.io.Reader reader) {
+ zzStreams.push(
+ new ZzFlexStreamInfo(zzReader, zzEndRead, zzStartRead, zzCurrentPos,
+ zzMarkedPos, zzBuffer, zzAtEOF,
+ yyline, yycolumn)
+ );
+ zzAtEOF = false;
+ zzBuffer = new char[ZZ_BUFFERSIZE];
+ zzReader = reader;
+ zzEndRead = zzStartRead = 0;
+ zzCurrentPos = zzMarkedPos = 0;
+ yyline = yycolumn = 0;
+ }
+
+
+ /**
+ * Closes the current input stream and continues to
+ * read from the one on top of the stream stack.
+ *
+ * @throws java.util.EmptyStackException
+ * if there is no further stream to read from.
+ *
+ * @throws java.io.IOException
+ * if there was an error in closing the stream.
+ *
+ * @see #yypushStream(java.io.Reader)
+ */
+ public final void yypopStream() throws java.io.IOException {
+ zzReader.close();
+ ZzFlexStreamInfo s = (ZzFlexStreamInfo) zzStreams.pop();
+ zzBuffer = s.zzBuffer;
+ zzReader = s.zzReader;
+ zzEndRead = s.zzEndRead;
+ zzStartRead = s.zzStartRead;
+ zzCurrentPos = s.zzCurrentPos;
+ zzMarkedPos = s.zzMarkedPos ;
+ zzAtEOF = s.zzAtEOF;
+ zzEOFDone = s.zzEOFDone;
+ yyline = s.yyline;
+ yycolumn = s.yycolumn;
+ }
+
+
+ /**
+ * Returns true iff there are still streams left
+ * to read from on the stream stack.
+ */
+ public final boolean yymoreStreams() {
+ return !zzStreams.isEmpty();
+ }
+
+
+ /**
+ * Resets the scanner to read from a new input stream.
+ * Does not close the old reader.
+ *
+ * All internal variables are reset, the old input stream
+ * cannot be reused (internal buffer is discarded and lost).
+ * Lexical state is set to ZZ_INITIAL.
+ *
+ * @param reader the new input stream
+ *
+ * @see #yypushStream(java.io.Reader)
+ * @see #yypopStream()
+ */
+ public final void yyreset(java.io.Reader reader) {
+ zzReader = reader;
+ zzAtBOL = true;
+ zzAtEOF = false;
+ zzEOFDone = false;
+ zzEndRead = zzStartRead = 0;
+ zzCurrentPos = zzMarkedPos = 0;
+ yyline = yychar = yycolumn = 0;
+ zzLexicalState = YYINITIAL;
+ }
+
+
+ /**
+ * Returns the current lexical state.
+ */
+ public final int yystate() {
+ return zzLexicalState;
+ }
+
+
+ /**
+ * Enters a new lexical state
+ *
+ * @param newState the new lexical state
+ */
+ public final void yybegin(int newState) {
+ zzLexicalState = newState;
+ }
+
+
+ /**
+ * Returns the text matched by the current regular expression.
+ */
+ public final String yytext() {
+ return new String( zzBuffer, zzStartRead, zzMarkedPos-zzStartRead );
+ }
+
+
+ /**
+ * Returns the character at position pos from the
+ * matched text.
+ *
+ * It is equivalent to yytext().charAt(pos), but faster
+ *
+ * @param pos the position of the character to fetch.
+ * A value from 0 to yylength()-1.
+ *
+ * @return the character at position pos
+ */
+ public final char yycharat(int pos) {
+ return zzBuffer[zzStartRead+pos];
+ }
+
+
+ /**
+ * Returns the length of the matched text region.
+ */
+ public final int yylength() {
+ return zzMarkedPos-zzStartRead;
+ }
+
+
+ /**
+ * Reports an error that occured while scanning.
+ *
+ * In a wellformed scanner (no or only correct usage of
+ * yypushback(int) and a match-all fallback rule) this method
+ * will only be called with things that "Can't Possibly Happen".
+ * If this method is called, something is seriously wrong
+ * (e.g. a JFlex bug producing a faulty scanner etc.).
+ *
+ * Usual syntax/scanner level error handling should be done
+ * in error fallback rules.
+ *
+ * @param errorCode the code of the errormessage to display
+ */
+--- zzScanError declaration
+ String message;
+ try {
+ message = ZZ_ERROR_MSG[errorCode];
+ }
+ catch (ArrayIndexOutOfBoundsException e) {
+ message = ZZ_ERROR_MSG[ZZ_UNKNOWN_ERROR];
+ }
+
+--- throws clause
+ }
+
+
+ /**
+ * Pushes the specified amount of characters back into the input stream.
+ *
+ * They will be read again by then next call of the scanning method
+ *
+ * @param number the number of characters to be read again.
+ * This number must not be greater than yylength()!
+ */
+--- yypushback decl (contains zzScanError exception)
+ if ( number > yylength() )
+ zzScanError(ZZ_PUSHBACK_2BIG);
+
+ zzMarkedPos -= number;
+ }
+
+
+--- zzDoEOF
+ /**
+ * Resumes scanning until the next regular expression is matched,
+ * the end of input is encountered or an I/O-Error occurs.
+ *
+ * @return the next token
+ * @exception java.io.IOException if any I/O-Error occurs
+ */
+--- yylex declaration
+ int zzInput;
+ int zzAction;
+
+--- local declarations
+
+ while (true) {
+ // cached fields:
+ int zzCurrentPosL;
+ int zzMarkedPosL = zzMarkedPos;
+ int zzEndReadL = zzEndRead;
+ char [] zzBufferL = zzBuffer;
+ char [] zzCMapL = ZZ_CMAP;
+
+--- start admin (line, char, col count)
+ zzAction = -1;
+
+ zzCurrentPosL = zzCurrentPos = zzStartRead = zzMarkedPosL;
+
+--- start admin (lexstate etc)
+
+ zzForAction: {
+ while (true) {
+
+--- next input, line, col, char count, next transition, isFinal action
+ zzAction = zzState;
+ zzMarkedPosL = zzCurrentPosL;
+--- line count update
+ }
+
+ }
+ }
+
+ // store back cached position
+ zzMarkedPos = zzMarkedPosL;
+--- char count update
+
+--- actions
+ default:
+ if (zzInput == YYEOF && zzStartRead == zzCurrentPos) {
+ zzAtEOF = true;
+--- eofvalue
+ }
+ else {
+--- no match
+ }
+ }
+ }
+ }
+
+--- main
+
+}
Index: /other-projects/gli-rsyntax-textarea/devel.bash
===================================================================
--- /other-projects/gli-rsyntax-textarea/devel.bash (revision 25585)
+++ /other-projects/gli-rsyntax-textarea/devel.bash (revision 25585)
@@ -0,0 +1,47 @@
+
+extdesc="the Developer's RSyntax Text Area Extension"
+
+full_setup=`pwd`/${BASH_SOURCE}
+fulldir=${full_setup%/*}
+fulldir=${fulldir%/.}
+
+##source cascade-make/lib/cascade-lib.bash
+
+if [ "x$GEXTRSYNTAX" = "x" ] ; then
+ export GEXTRSYNTAX=$fulldir
+ export GEXTRSYNTAX_INSTALLED=$GEXTRSYNTAX/$GSDLOS
+
+# export PATH=$GEXTRSYNTAX_INSTALLED/bin:$PATH
+
+ export PATH=$GEXTRSYNTAX/bin/script:$PATH
+
+# if [ "x$LD_LIBRARY_PATH" = "x" ] ; then
+# export LD_LIBRARY_PATH=$GEXTRSYNTAX_INSTALLED/lib
+# else
+# export LD_LIBRARY_PATH=$GEXTRSYNTAX_INSTALLED/lib:$LD_LIBRARY_PATH
+# fi
+# if [ "x$DYLD_LIBRARY_PATH" = "x" ] ; then
+# export DYLD_LIBRARY_PATH=$GEXTRSYNTAX_INSTALLED/lib
+# else
+# export DYLD_LIBRARY_PATH=$GEXTRSYNTAX_INSTALLED/lib:$DYLD_LIBRARY_PATH
+# fi
+
+# if [ -e "devel-srcpack" ] ; then
+# export LD_LIBRARY_PATH=$GEXTRSYNTAX_INSTALLED/devel/lib:$LD_LIBRARY_PATH
+# export DYLD_LIBRARY_PATH=$GEXTRSYNTAX_INSTALLED/devel/lib:$DYLD_LIBRARY_PATH
+# fi
+
+
+ extdir=${GEXTRSYNTAX##*/}
+
+ if [ "x$GSDLEXTS" = "x" ] ; then
+ export GSDLEXTS=$extdir
+ else
+ export GSDLEXTS=$GSDLEXTS:$extdir
+ fi
+
+
+ echo "+Your environment is now setup for $extdesc"
+else
+ echo "+Your environment is already setup for $extdesc"
+fi
Index: /other-projects/gli-rsyntax-textarea/lib/jflex-mode.el
===================================================================
--- /other-projects/gli-rsyntax-textarea/lib/jflex-mode.el (revision 25585)
+++ /other-projects/gli-rsyntax-textarea/lib/jflex-mode.el (revision 25585)
@@ -0,0 +1,114 @@
+; -*- Mode: Emacs-Lisp; -*-
+
+;;; jflex-mode
+
+;;; author: Gerwin Klein
+;;; $Revision: 50 $, $Date: 2003-06-08 21:01:12 +1000 (Sun, 08 Jun 2003) $
+
+(require 'derived)
+(require 'font-lock)
+
+(define-derived-mode jflex-mode java-mode "JFlex"
+ "Major mode for editing JFlex files"
+
+ ;; set the indentation
+ (setq c-basic-offset 2)
+
+ (c-set-offset 'knr-argdecl-intro 0)
+ (c-set-offset 'topmost-intro-cont 0)
+
+ ;; remove auto and hungry anything
+ (c-toggle-auto-hungry-state -1)
+ (c-toggle-auto-state -1)
+ (c-toggle-hungry-state -1)
+
+ (use-local-map jflex-mode-map)
+
+ ;; get rid of that damn electric-brace
+ (define-key jflex-mode-map "{" 'self-insert-command)
+ (define-key jflex-mode-map "}" 'self-insert-command)
+
+ (define-key jflex-mode-map [tab] 'jflex-indent-command)
+
+ )
+
+(defalias 'jflex-indent-command 'c-indent-command)
+
+(defconst jflex-font-lock-keywords
+ (append
+ '(
+ ("^%%" . font-lock-reference-face)
+ "^%{"
+ "^%init{"
+ "^%initthrow{"
+ "^%eof{"
+ "^%eofthrow{"
+ "^%yylexthrow{"
+ "^%eofval{"
+ "^%}"
+ "^%init}"
+ "^%initthrow}"
+ "^%eof}"
+ "^%eofthrow}"
+ "^%yylexthrow}"
+ "^%eofval}"
+ "^%standalone"
+ "^%scanerror"
+ "^%switch"
+ "^%states" ; fixme: state identifiers
+ "^%state"
+ "^%s"
+ "^%xstates"
+ "^%xstate"
+ "^%x"
+ "^%char"
+ "^%line"
+ "^%column"
+ "^%byaccj"
+ "^%cupsym"
+ "^%cupdebug"
+ "^%cup"
+ "^%eofclose"
+ "^%class"
+ "^%function"
+ "^%type"
+ "^%integer"
+ "^%intwrap"
+ "^%int"
+ "^%yyeof"
+ "^%notunix"
+ "^%7bit"
+ "^%full"
+ "^%8bit"
+ "^%unicode"
+ "^%16bit"
+ "^%caseless"
+ "^%ignorecase"
+ "^%implements"
+ "^%extends"
+ "^%public"
+ "^%apiprivate"
+ "^%final"
+ "^%abstract"
+ "^%debug"
+ "^%table"
+ "^%pack"
+ "^%include"
+ "^%buffer"
+ "^%initthrow"
+ "^%eofthrow"
+ "^%yylexthrow"
+ "^%throws"
+ ("%[%{}0-9a-zA-Z]+" . font-lock-warning-face) ; errors
+ ("{[ \t]*[a-zA-Z][0-9a-zA-Z_]+[ \t]*}" . font-lock-variable-name-face) ; macro uses
+ "<>" ; special <> symbol
+ ("<[ \t]*[a-zA-Z][0-9a-zA-Z_]+[ \t]*\\(,[ \t]*[a-zA-Z][0-9a-zA-Z_]+[ \t]*\\)*>" . font-lock-type-face) ; lex state list
+ )
+ java-font-lock-keywords-2)
+ "JFlex keywords for font-lock mode")
+
+(put 'jflex-mode 'font-lock-defaults
+ '(jflex-font-lock-keywords
+ nil nil ((?_ . "w")) beginning-of-defun))
+
+(provide 'jflex-mode)
Index: /other-projects/gli-rsyntax-textarea/lib/jflex.vim
===================================================================
--- /other-projects/gli-rsyntax-textarea/lib/jflex.vim (revision 25585)
+++ /other-projects/gli-rsyntax-textarea/lib/jflex.vim (revision 25585)
@@ -0,0 +1,149 @@
+" Vim syntax file
+" Language: JFlex
+" Maintainer: Gerwin Klein
+" Last Change: $Revision: 50 $, $Date: 2003-06-08 21:01:12 +1000 (Sun, 08 Jun 2003) $
+
+" Thanks to Michael Brailsford for help and suggestions
+
+" Quit when a syntax file was already loaded {{{
+if exists("b:current_syntax")
+ finish
+endif
+"}}}
+
+" Include java syntax {{{
+if version >= 600
+ runtime! syntax/java.vim
+ unlet b:current_syntax
+else
+ so $VIMRUNTIME/syntax/java.vim
+endif
+"}}}
+
+syn cluster jflexOptions contains=jflexOption,jflexCodeInclude,jflexComment,jflexMacroIdent,jflexMacroRegExp,jflexOptionError
+syn cluster jflexRules contains=jflexRule,jflexComment,jflexActionCode,jflexRuleStates,jflexRegExp
+
+" java code section
+syn region jflexStart start="/\*\|//\|import\|package\|class"me=s end="^%%"me=e-2 contains=@javaTop nextgroup=jflexOptionReg
+
+" %%
+" options
+syn region jflexOptionReg matchgroup=jflexSectionSep start="^%%" end="^%%"me=e-2 contains=@jflexOptions nextgroup=jflexRulesReg
+
+syn match jflexOptionError "%\i*" contained
+
+syn match jflexOption "^\(%s\|%x\)" contained
+syn match jflexOption "^%state" contained
+syn match jflexOption "^%states" contained
+syn match jflexOption "^%xstate" contained
+syn match jflexOption "^%xstates" contained
+syn match jflexOption "^%char" contained
+syn match jflexOption "^%line" contained
+syn match jflexOption "^%column" contained
+syn match jflexOption "^%byaccj" contained
+syn match jflexOption "^%cup" contained
+syn match jflexOption "^%cupsym" contained
+syn match jflexOption "^%cupdebug" contained
+syn match jflexOption "^%eofclose" contained
+syn match jflexOption "^%class" contained
+syn match jflexOption "^%function" contained
+syn match jflexOption "^%type" contained
+syn match jflexOption "^%integer" contained
+syn match jflexOption "^%int" contained
+syn match jflexOption "^%intwrap" contained
+syn match jflexOption "^%yyeof" contained
+syn match jflexOption "^%notunix" contained
+syn match jflexOption "^%7bit" contained
+syn match jflexOption "^%8bit" contained
+syn match jflexOption "^%full" contained
+syn match jflexOption "^%16bit" contained
+syn match jflexOption "^%unicode" contained
+syn match jflexOption "^%caseless" contained
+syn match jflexOption "^%ignorecase" contained
+syn match jflexOption "^%implements" contained
+syn match jflexOption "^%extends" contained
+syn match jflexOption "^%public" contained
+syn match jflexOption "^%apiprivate" contained
+syn match jflexOption "^%final" contained
+syn match jflexOption "^%abstract" contained
+syn match jflexOption "^%debug" contained
+syn match jflexOption "^%standalone" contained
+syn match jflexOption "^%switch" contained
+syn match jflexOption "^%table" contained
+syn match jflexOption "^%pack" contained
+syn match jflexOption "^%include" contained
+syn match jflexOption "^%buffer" contained
+syn match jflexOption "^%initthrow" contained
+syn match jflexOption "^%eofthrow" contained
+syn match jflexOption "^%yylexthrow" contained
+syn match jflexOption "^%throws" contained
+syn match jflexOption "^%scannerror" contained
+
+syn match jflexMacroIdent "\I\i*\s*="me=e-1 contained nextgroup=jflexMacroRegExp
+
+syn region jflexMacroRegExp matchgroup=jflexOperator start="=" end="^\(%\|\I\|\i\|/\)"me=e-1 contains=NONE contained
+
+syn region jflexCodeInclude matchgroup=jflexCodeIncludeMark start="^%{" end="^%}" contains=@javaTop contained
+syn region jflexCodeInclude matchgroup=jflexCodeIncludeMark start="^%init{" end="^%init}" contains=@javaTop contained
+syn region jflexCodeInclude matchgroup=jflexCodeIncludeMark start="^%initthrow{" end="^%initthrow}" contains=@javaTop contained
+syn region jflexCodeInclude matchgroup=jflexCodeIncludeMark start="^%eof{" end="^%eof}" contains=@javaTop contained
+syn region jflexCodeInclude matchgroup=jflexCodeIncludeMark start="^%eofthrow{" end="^%eofthrow}" contains=@javaTop contained
+syn region jflexCodeInclude matchgroup=jflexCodeIncludeMark start="^%yylexthrow{" end="^%yylexthrow}" contains=@javaTop contained
+syn region jflexCodeInclude matchgroup=jflexCodeIncludeMark start="^%eofval{" end="^%eofval}" contains=@javaTop contained
+
+" rules (end pattern shouldn't occur, if it does anyway we just stay in jflexRulesReg)
+syn region jflexRulesReg matchgroup=jflexSectionSep start="^%%" end="^%%"me=e-2 contains=@jflexRules
+
+" at first everything but strings is a regexp
+syn match jflexRegExp "\([^\" \t]\|\\\"\)\+" contained
+
+" take out comments
+syn match jflexComment "//.*" contained
+syn region jflexComment start="/\*" end="\*/" contained contains=jflexComment
+
+" lex states
+syn match jflexRuleStates "<\s*\I\i*\(\s*,\s*\I\i*\)*\s*>" contained skipnl skipwhite nextgroup=jflexStateGroup
+
+" action code (only after states braces and macro use)
+syn region jflexActionCode matchgroup=Delimiter start="{" end="}" contained contains=@javaTop,jflexJavaBraces
+
+" macro use
+syn match jflexRegExp "{\s*\I\i*\s*}" contained
+
+" state braces (only active after )
+syn region jflexStateGroup matchgroup=jflexRuleStates start="{$" start="{\s" end="}" contained contains=@jflexRules
+
+" string
+syn region jflexRegExp matchgroup=String start=+"+ skip=+\\\\\|\\"+ end=+"+ contained
+
+" not to be confused with a state
+syn match jflexRegExp "<>" contained
+
+" escape sequence
+syn match jflexRegExp "\\." contained
+
+
+" keep braces in actions balanced
+syn region jflexJavaBraces start="{" end="}" contained contains=@javaTop,jflexJavaBraces
+
+
+" syncing
+syn sync clear
+syn sync minlines=10
+syn sync match jflexSync grouphere jflexOptionReg "^%[a-z]"
+syn sync match jflexSync grouphere jflexRulesReg "^<"
+
+
+" highlighting
+hi link jflexOption Special
+hi link jflexMacroIdent Ident
+hi link jflexMacroRegExp Macro
+hi link jflexOptionError Error
+hi link jflexComment Comment
+hi link jflexOperator Operator
+hi link jflexRuleStates Special
+hi link jflexRegExp Function
+hi jflexSectionSep guifg=yellow ctermfg=yellow guibg=blue ctermbg=blue gui=bold cterm=bold
+hi link jflexCodeIncludeMark jflexSectionSep
+
+let b:current_syntax="jflex"
Index: /other-projects/gli-rsyntax-textarea/src/.classpath
===================================================================
--- /other-projects/gli-rsyntax-textarea/src/.classpath (revision 25585)
+++ /other-projects/gli-rsyntax-textarea/src/.classpath (revision 25585)
@@ -0,0 +1,10 @@
+
+
+
+
+
+
+
+
+
+
Index: /other-projects/gli-rsyntax-textarea/src/REGENERATE-FLEX.sh
===================================================================
--- /other-projects/gli-rsyntax-textarea/src/REGENERATE-FLEX.sh (revision 25585)
+++ /other-projects/gli-rsyntax-textarea/src/REGENERATE-FLEX.sh (revision 25585)
@@ -0,0 +1,18 @@
+#!/bin/bash
+
+pushd java/org/fife/ui/rsyntaxtextarea/modes/
+
+
+for f in *.flex ; do
+ echo "Checking $f ..."
+ if [ $f -nt ${f%.*}.java ] ; then
+ jflex $f
+ echo "... regenerated"
+ else
+ echo "... does not need to be regenerated"
+ fi
+
+
+done
+
+popd
Index: /other-projects/gli-rsyntax-textarea/src/build.xml
===================================================================
--- /other-projects/gli-rsyntax-textarea/src/build.xml (revision 25585)
+++ /other-projects/gli-rsyntax-textarea/src/build.xml (revision 25585)
@@ -0,0 +1,108 @@
+
+
+
+
+
+
+
+ RSyntaxTextArea build file
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Index: /other-projects/gli-rsyntax-textarea/src/dist/RSyntaxTextArea.License.txt
===================================================================
--- /other-projects/gli-rsyntax-textarea/src/dist/RSyntaxTextArea.License.txt (revision 25585)
+++ /other-projects/gli-rsyntax-textarea/src/dist/RSyntaxTextArea.License.txt (revision 25585)
@@ -0,0 +1,24 @@
+Copyright (c) 2012, Robert Futrell
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+ * Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+ * Neither the name of the author nor the names of its contributors may
+ be used to endorse or promote products derived from this software
+ without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY
+DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Index: /other-projects/gli-rsyntax-textarea/src/dist/readme.txt
===================================================================
--- /other-projects/gli-rsyntax-textarea/src/dist/readme.txt (revision 25585)
+++ /other-projects/gli-rsyntax-textarea/src/dist/readme.txt (revision 25585)
@@ -0,0 +1,35 @@
+RSyntaxTextArea Readme
+----------------------
+Please contact me if you are using RSyntaxTextArea in your project! I like
+to know when people are finding it useful. Please send mail to:
+robert -at- fifesoft dot com.
+
+
+* About RSyntaxTextArea
+
+ RSyntaxTextArea is a syntax highlighting text component, written in Swing.
+ It allows applications to easily embed syntax highlighting for most common
+ programming languages. Most other standard programmer's editor features are
+ built-in: auto-indent, bracket matching, undo/redo, etc. Auto-completion
+ is available as an add-on library (see http://fifesoft.com/autocomplete).
+
+* License
+
+ RSyntaxTextArea is licensed under a modified BSD license. Please see the
+ included RSyntaxTextArea.License.txt file.
+
+* Feedback
+
+ I hope you find RSyntaxTextArea useful. Bug reports, feature requests, and
+ just general questions are always welcome. Ways you can submit feedback:
+
+ * http://forum.fifesoft.com (preferred)
+ Has a forum for RSyntaxTextArea and related projects, where you can
+ ask questions and get feedback quickly.
+
+ * http://sourceforge.net/projects/rsyntaxtextarea
+ Has a tracker for bug reports, feature requests, etc.
+
+ * http://fifesoft.com/rsyntaxtextarea
+ Project home page, which contains general information and example
+ source code.
Index: /other-projects/gli-rsyntax-textarea/src/distfiles/RSyntaxTextArea.License.txt
===================================================================
--- /other-projects/gli-rsyntax-textarea/src/distfiles/RSyntaxTextArea.License.txt (revision 25585)
+++ /other-projects/gli-rsyntax-textarea/src/distfiles/RSyntaxTextArea.License.txt (revision 25585)
@@ -0,0 +1,24 @@
+Copyright (c) 2012, Robert Futrell
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+ * Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+ * Neither the name of the author nor the names of its contributors may
+ be used to endorse or promote products derived from this software
+ without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY
+DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Index: /other-projects/gli-rsyntax-textarea/src/distfiles/readme.txt
===================================================================
--- /other-projects/gli-rsyntax-textarea/src/distfiles/readme.txt (revision 25585)
+++ /other-projects/gli-rsyntax-textarea/src/distfiles/readme.txt (revision 25585)
@@ -0,0 +1,35 @@
+RSyntaxTextArea Readme
+----------------------
+Please contact me if you are using RSyntaxTextArea in your project! I like
+to know when people are finding it useful. Please send mail to:
+robert -at- fifesoft dot com.
+
+
+* About RSyntaxTextArea
+
+ RSyntaxTextArea is a syntax highlighting text component, written in Swing.
+ It allows applications to easily embed syntax highlighting for most common
+ programming languages. Most other standard programmer's editor features are
+ built-in: auto-indent, bracket matching, undo/redo, etc. Auto-completion
+ is available as an add-on library (see http://fifesoft.com/autocomplete).
+
+* License
+
+ RSyntaxTextArea is licensed under a modified BSD license. Please see the
+ included RSyntaxTextArea.License.txt file.
+
+* Feedback
+
+ I hope you find RSyntaxTextArea useful. Bug reports, feature requests, and
+ just general questions are always welcome. Ways you can submit feedback:
+
+ * http://forum.fifesoft.com (preferred)
+ Has a forum for RSyntaxTextArea and related projects, where you can
+ ask questions and get feedback quickly.
+
+ * http://sourceforge.net/projects/rsyntaxtextarea
+ Has a tracker for bug reports, feature requests, etc.
+
+ * http://fifesoft.com/rsyntaxtextarea
+ Project home page, which contains general information and example
+ source code.
Index: /other-projects/gli-rsyntax-textarea/src/i18n/org/fife/ui/rsyntaxtextarea/ErrorStrip.properties
===================================================================
--- /other-projects/gli-rsyntax-textarea/src/i18n/org/fife/ui/rsyntaxtextarea/ErrorStrip.properties (revision 25585)
+++ /other-projects/gli-rsyntax-textarea/src/i18n/org/fife/ui/rsyntaxtextarea/ErrorStrip.properties (revision 25585)
@@ -0,0 +1,3 @@
+Line=Line: {0}
+MultipleMarkers=Multiple markers at this line:
+OccurrenceOf=Occurrence of "{0}"
Index: /other-projects/gli-rsyntax-textarea/src/i18n/org/fife/ui/rsyntaxtextarea/RSyntaxTextArea.properties
===================================================================
--- /other-projects/gli-rsyntax-textarea/src/i18n/org/fife/ui/rsyntaxtextarea/RSyntaxTextArea.properties (revision 25585)
+++ /other-projects/gli-rsyntax-textarea/src/i18n/org/fife/ui/rsyntaxtextarea/RSyntaxTextArea.properties (revision 25585)
@@ -0,0 +1,14 @@
+ContextMenu.Folding=Folding
+
+Action.ToggleCurrentFold.Name=Toggle Current Fold
+Action.ToggleCurrentFold.Mnemonic=F
+Action.ToggleCurrentFold.Desc=Toggles the fold at the caret position.
+Action.CollapseAllFolds.Name=Collapse All Folds
+Action.CollapseAllFolds.Mnemonic=O
+Action.CollapseAllFolds.Desc=Collapses all folds.
+Action.CollapseCommentFolds.Name=Collapse All Comments
+Action.CollapseCommentFolds.Mnemonic=C
+Action.CollapseCommentFolds.Desc=Collapses all comment folds.
+Action.ExpandAllFolds.Name=Expand All Folds
+Action.ExpandAllFolds.Mnemonic=E
+Action.ExpandAllFolds.Desc=Expands all folds.
Index: /other-projects/gli-rsyntax-textarea/src/i18n/org/fife/ui/rsyntaxtextarea/focusabletip/FocusableTip.properties
===================================================================
--- /other-projects/gli-rsyntax-textarea/src/i18n/org/fife/ui/rsyntaxtextarea/focusabletip/FocusableTip.properties (revision 25585)
+++ /other-projects/gli-rsyntax-textarea/src/i18n/org/fife/ui/rsyntaxtextarea/focusabletip/FocusableTip.properties (revision 25585)
@@ -0,0 +1,1 @@
+FocusHotkey=Press 'F2' for focus
Index: /other-projects/gli-rsyntax-textarea/src/i18n/org/fife/ui/rtextarea/RTextArea.properties
===================================================================
--- /other-projects/gli-rsyntax-textarea/src/i18n/org/fife/ui/rtextarea/RTextArea.properties (revision 25585)
+++ /other-projects/gli-rsyntax-textarea/src/i18n/org/fife/ui/rtextarea/RTextArea.properties (revision 25585)
@@ -0,0 +1,29 @@
+Action.Copy.Mnemonic=C
+Action.Copy.Name=Copy
+Action.Copy.Desc=Copies current selection to the clipboard.
+
+Action.Cut.Mnemonic=T
+Action.Cut.Name=Cut
+Action.Cut.Desc=Removes current selection and places it on the clipboard.
+
+Action.Delete.Mnemonic=D
+Action.Delete.Name=Delete
+Action.Delete.Desc=Removes current selection.
+
+Action.Paste.Mnemonic=P
+Action.Paste.Name=Paste
+Action.Paste.Desc=Places text on clipboard at current location in text file.
+
+Action.SelectAll.Mnemonic=A
+Action.SelectAll.Name=Select All
+Action.SelectAll.Desc=Selects all text in current text document.
+
+Action.Undo.Mnemonic=U
+Action.Undo.Name=Undo
+Action.CantUndo.Name=Can't Undo
+Action.Undo.Desc=Takes back the last action.
+
+Action.Redo.Mnemonic=R
+Action.Redo.Name=Redo
+Action.CantRedo.Name=Can't Redo
+Action.Redo.Desc=Re-applies the last action undone.
Index: /other-projects/gli-rsyntax-textarea/src/i18n/org/fife/ui/rtextarea/RTextArea_ar.properties
===================================================================
--- /other-projects/gli-rsyntax-textarea/src/i18n/org/fife/ui/rtextarea/RTextArea_ar.properties (revision 25585)
+++ /other-projects/gli-rsyntax-textarea/src/i18n/org/fife/ui/rtextarea/RTextArea_ar.properties (revision 25585)
@@ -0,0 +1,27 @@
+Action.Copy.Mnemonic=\u0646
+Action.Copy.Name=\u0646\u0633\u062e
+Action.Copy.Desc=\u0646\u0633\u062e \u0645\u062d\u062a\u0648\u0649 \u0627\u0644\u062a\u062d\u062f\u064a\u062f \u0627\u0644\u062d\u0627\u0644\u064a \u0625\u0644\u0649 \u0627\u0644\u062d\u0627\u0641\u0638\u0629.
+
+Action.Cut.Mnemonic=\u0642
+Action.Cut.Name=\u0642\u0635
+Action.Cut.Desc=\u0645\u0633\u062d \u0645\u062d\u062a\u0648\u0649 \u0627\u0644\u062a\u062d\u062f\u064a\u062f \u0627\u0644\u062d\u0627\u0644\u064a \u0648\u0646\u0642\u0644\u0647 \u0625\u0644\u0649 \u0627\u0644\u062d\u0627\u0641\u0638\u0629.
+
+Action.Delete.Mnemonic=\u062d
+Action.Delete.Name=\u062d\u0630\u0641
+Action.Delete.Desc=\u062d\u0630\u0641 \u0645\u062d\u062a\u0648\u0649 \u0627\u0644\u062a\u062d\u062f\u064a\u062f \u0627\u0644\u062d\u0627\u0644\u064a.
+
+Action.Paste.Mnemonic=\u0644
+Action.Paste.Name=\u0644\u0635\u0642
+Action.Paste.Desc=\u0644\u0635\u0642 \u0627\u0644\u0646\u0635 \u0627\u0644\u0645\u0648\u062c\u0648\u062f \u0641\u064a \u0627\u0644\u062d\u0627\u0641\u0638\u0629 \u0641\u064a \u0647\u0630\u0627 \u0627\u0644\u0645\u0643\u0627\u0646.
+
+Action.SelectAll.Mnemonic=\u0643
+Action.SelectAll.Name=\u0627\u062e\u062a\u064a\u0627\u0631 \u0627\u0644\u0643\u0644
+Action.SelectAll.Desc=\u062a\u062d\u062f\u064a\u062f \u062c\u0645\u064a\u0639 \u0627\u0644\u0646\u0635 \u0641\u064a \u0627\u0644\u0645\u0633\u062a\u0646\u062f \u0627\u0644\u062d\u0627\u0644\u064a.
+
+Action.Undo.Mnemonic=U
+Action.CantUndo.Name=\u0644\u0627 \u064a\u0645\u0643\u0646 \u0627\u0644\u062a\u0631\u0627\u062c\u0639
+Action.Undo.Desc=\u0627\u0644\u062a\u0631\u0627\u062c\u0639 \u0639\u0646 \u0622\u062e\u0631 \u062e\u0637\u0648\u0629.
+
+Action.Redo.Mnemonic=R
+Action.CantRedo.Name=\u0644\u0627 \u064a\u0645\u0643\u0646 \u0625\u0644\u063a\u0627\u0621 \u0627\u0644\u062a\u0631\u0627\u062c\u0639
+Action.Redo.Desc=\u0625\u0644\u063a\u0627\u0621 \u0627\u0644\u062a\u0631\u0627\u062c\u0639 \u0639\u0646 \u0622\u062e\u0631 \u062e\u0637\u0648\u0629.
Index: /other-projects/gli-rsyntax-textarea/src/i18n/org/fife/ui/rtextarea/RTextArea_de.properties
===================================================================
--- /other-projects/gli-rsyntax-textarea/src/i18n/org/fife/ui/rtextarea/RTextArea_de.properties (revision 25585)
+++ /other-projects/gli-rsyntax-textarea/src/i18n/org/fife/ui/rtextarea/RTextArea_de.properties (revision 25585)
@@ -0,0 +1,27 @@
+Action.Copy.Mnemonic=C
+Action.Copy.Name=Kopieren
+Action.Copy.Desc=Kopiert die aktuelle Auswahl in die Zwischenablage.
+
+Action.Cut.Mnemonic=U
+Action.Cut.Name=Ausschneiden
+Action.Cut.Desc=Ausschneiden in die Zwischenablage.
+
+Action.Delete.Mnemonic=L
+Action.Delete.Name=L\u00f6schen
+Action.Delete.Desc=Auswahl entfernen.
+
+Action.Paste.Mnemonic=I
+Action.Paste.Name=Einf\u00fcgen
+Action.Paste.Desc=Zwischenablage hier einf\u00fcgen.
+
+Action.SelectAll.Mnemonic=A
+Action.SelectAll.Name=Alle ausw\u00e4hlen
+Action.SelectAll.Desc=W\u00e4hlt den gesamten Text aus.
+
+Action.Undo.Mnemonic=U
+Action.CantUndo.Name=R\u00fcckg\u00e4ngig nicht m\u00f6glich
+Action.Undo.Desc=Macht die letzte Aktion r\u00fcckg\u00e4ngig.
+
+Action.Redo.Mnemonic=R
+Action.CantRedo.Name=Wiederholung nicht m\u00f6glich
+Action.Redo.Desc=Wiederholt die letzte Aktion.
Index: /other-projects/gli-rsyntax-textarea/src/i18n/org/fife/ui/rtextarea/RTextArea_es.properties
===================================================================
--- /other-projects/gli-rsyntax-textarea/src/i18n/org/fife/ui/rtextarea/RTextArea_es.properties (revision 25585)
+++ /other-projects/gli-rsyntax-textarea/src/i18n/org/fife/ui/rtextarea/RTextArea_es.properties (revision 25585)
@@ -0,0 +1,27 @@
+Action.Copy.Mnemonic=C
+Action.Copy.Name=Copiar
+Action.Copy.Desc=Copia la selecci\u00f3n actual en el portapapeles.
+
+Action.Cut.Mnemonic=T
+Action.Cut.Name=Cortar
+Action.Cut.Desc=Elimina la selecci\u00f3n actual y la p\u00f3ne en el portapapeles.
+
+Action.Delete.Mnemonic=D
+Action.Delete.Name=Eliminar
+Action.Delete.Desc=Elimina la selecci\u00f3n actual.
+
+Action.Paste.Mnemonic=P
+Action.Paste.Name=Pegar
+Action.Paste.Desc=P\u00f3ne el texto del portapapeles en la posici\u00f3n actual del archivo de texto.
+
+Action.SelectAll.Mnemonic=A
+Action.SelectAll.Name=Seleccionar todo
+Action.SelectAll.Desc=Selecciona todo el texto en el documento de texto actual.
+
+Action.Undo.Mnemonic=U
+Action.CantUndo.Name=No se puede deshacer
+Action.Undo.Desc=Deshace la \u00faltima acci\u00f3n.
+
+Action.Redo.Mnemonic=R
+Action.CantRedo.Name=No se puede rehacer
+Action.Redo.Desc=Rehace la \u00faltima acci\u00f3n deshecha.
Index: /other-projects/gli-rsyntax-textarea/src/i18n/org/fife/ui/rtextarea/RTextArea_fr.properties
===================================================================
--- /other-projects/gli-rsyntax-textarea/src/i18n/org/fife/ui/rtextarea/RTextArea_fr.properties (revision 25585)
+++ /other-projects/gli-rsyntax-textarea/src/i18n/org/fife/ui/rtextarea/RTextArea_fr.properties (revision 25585)
@@ -0,0 +1,27 @@
+Action.Copy.Mnemonic=C
+Action.Copy.Name=Copier
+Action.Copy.Desc=Copie la s\u00e9lection dans le presse-papiers.
+
+Action.Cut.Mnemonic=T
+Action.Cut.Name=Couper
+Action.Cut.Desc=Coupe la s\u00e9lection et la place dans le presse-papiers.
+
+Action.Delete.Mnemonic=D
+Action.Delete.Name=Effacer
+Action.Delete.Desc=Efface la s\u00e9lection.
+
+Action.Paste.Mnemonic=P
+Action.Paste.Name=Coller
+Action.Paste.Desc=Insert le contenu du presse-papiers \u00e0 l'emplacement courant.
+
+Action.SelectAll.Mnemonic=A
+Action.SelectAll.Name=S\u00e9lectionner tout
+Action.SelectAll.Desc=S\u00e9lectionne tout le texte du document courant.
+
+Action.Undo.Mnemonic=U
+Action.CantUndo.Name=Annuler
+Action.Undo.Desc=Annule la derni\u00e8re action.
+
+Action.Redo.Mnemonic=R
+Action.CantRedo.Name=R\u00e9tablir
+Action.Redo.Desc=R\u00e9p\u00e8te la derni\u00e8re action annul\u00e9e.
Index: /other-projects/gli-rsyntax-textarea/src/i18n/org/fife/ui/rtextarea/RTextArea_hu.properties
===================================================================
--- /other-projects/gli-rsyntax-textarea/src/i18n/org/fife/ui/rtextarea/RTextArea_hu.properties (revision 25585)
+++ /other-projects/gli-rsyntax-textarea/src/i18n/org/fife/ui/rtextarea/RTextArea_hu.properties (revision 25585)
@@ -0,0 +1,27 @@
+Action.Copy.Mnemonic=M
+Action.Copy.Name=M\u00e1sol
+Action.Copy.Desc=\u00c1tm\u00e1solja a kijel\u00f6lt r\u00e9szt a v\u00e1g\u00f3lapra.
+
+Action.Cut.Mnemonic=K
+Action.Cut.Name=Kiv\u00e1g
+Action.Cut.Desc=T\u00f6rli a kijel\u00f6lt r\u00e9szt, \u00e9s \u00e1thelyezi a v\u00e1g\u00f3lapra.
+
+Action.Delete.Mnemonic=T
+Action.Delete.Name=T\u00f6r\u00f6l
+Action.Delete.Desc=T\u00f6rli a kijel\u00f6l\u00e9st.
+
+Action.Paste.Mnemonic=B
+Action.Paste.Name=Beilleszt
+Action.Paste.Desc=Beilleszti a v\u00e1g\u00f3lapon l\u00e9v\u0151 r\u00e9szt a dokumentumba.
+
+Action.SelectAll.Mnemonic=A
+Action.SelectAll.Name=Mindent kijel\u00f6l
+Action.SelectAll.Desc=Kijel\u00f6li az \u00f6sszes sz\u00f6veget a jelenlegi dokumentumban.
+
+Action.Undo.Mnemonic=U
+Action.CantUndo.Name=Nem vonhat\u00f3 vissza
+Action.Undo.Desc=Visszavonja az el\u0151z\u0151 m\u0171veletet.
+
+Action.Redo.Mnemonic=R
+Action.CantRedo.Name=Nem \u00e1ll\u00edthat\u00f3 vissza
+Action.Redo.Desc=\u00dajra elv\u00e9gzi az utolj\u00e1ra v\u00e9grehajtott m\u0171veletet, amit nem siker\u00fclt v\u00e9grehajtani.
Index: /other-projects/gli-rsyntax-textarea/src/i18n/org/fife/ui/rtextarea/RTextArea_in.properties
===================================================================
--- /other-projects/gli-rsyntax-textarea/src/i18n/org/fife/ui/rtextarea/RTextArea_in.properties (revision 25585)
+++ /other-projects/gli-rsyntax-textarea/src/i18n/org/fife/ui/rtextarea/RTextArea_in.properties (revision 25585)
@@ -0,0 +1,27 @@
+Action.Copy.Mnemonic=C
+Action.Copy.Name=Salin
+Action.Copy.Desc=Salin current selection ke clipboard.
+
+Action.Cut.Mnemonic=T
+Action.Cut.Name=Cut
+Action.Cut.Desc=Hapus current selection dan letakkan dalam clipboard.
+
+Action.Delete.Mnemonic=D
+Action.Delete.Name=Hapus
+Action.Delete.Desc=Hapus current selection.
+
+Action.Paste.Mnemonic=P
+Action.Paste.Name=Paste
+Action.Paste.Desc=Letakkan text pada clipboard di lokasi saat ini dalam text file.
+
+Action.SelectAll.Mnemonic=A
+Action.SelectAll.Name=Pilih Semua
+Action.SelectAll.Desc=Pilih semua text dalam dokumen text saat ini.
+
+Action.Undo.Mnemonic=U
+Action.CantUndo.Name=Tidak Dapat Undo
+Action.Undo.Desc=Kembali ke aksi terakhir.
+
+Action.Redo.Mnemonic=R
+Action.CantRedo.Name=Tidak dapat Redo
+Action.Redo.Desc=Ulangi aksi terakhir yang di-undone.
Index: /other-projects/gli-rsyntax-textarea/src/i18n/org/fife/ui/rtextarea/RTextArea_it.properties
===================================================================
--- /other-projects/gli-rsyntax-textarea/src/i18n/org/fife/ui/rtextarea/RTextArea_it.properties (revision 25585)
+++ /other-projects/gli-rsyntax-textarea/src/i18n/org/fife/ui/rtextarea/RTextArea_it.properties (revision 25585)
@@ -0,0 +1,27 @@
+Action.Copy.Mnemonic=C
+Action.Copy.Name=Copia
+Action.Copy.Desc=Copia la selezione corrente negli appunti.
+
+Action.Cut.Mnemonic=T
+Action.Cut.Name=Taglia
+Action.Cut.Desc=Rimuove la selezione corrente e la memorizza negli appunti.
+
+Action.Delete.Mnemonic=E
+Action.Delete.Name=Elimina
+Action.Delete.Desc=Rimuove la selezione corrente.
+
+Action.Paste.Mnemonic=I
+Action.Paste.Name=Incolla
+Action.Paste.Desc=Inserisce il testo presente negli appunti nella posizione corrente nel file di testo.
+
+Action.SelectAll.Mnemonic=E
+Action.SelectAll.Name=Seleziona tutto
+Action.SelectAll.Desc=Seleziona tutto il testo nel documento corrente.
+
+Action.Undo.Mnemonic=U
+Action.CantUndo.Name=Impossibile annullare
+Action.Undo.Desc=Annulla l'ultima azione.
+
+Action.Redo.Mnemonic=R
+Action.CantRedo.Name=Impossibile ripristinare
+Action.Redo.Desc=Riapplica l'ultima azione annullata.
Index: /other-projects/gli-rsyntax-textarea/src/i18n/org/fife/ui/rtextarea/RTextArea_ja.properties
===================================================================
--- /other-projects/gli-rsyntax-textarea/src/i18n/org/fife/ui/rtextarea/RTextArea_ja.properties (revision 25585)
+++ /other-projects/gli-rsyntax-textarea/src/i18n/org/fife/ui/rtextarea/RTextArea_ja.properties (revision 25585)
@@ -0,0 +1,27 @@
+Action.Copy.Mnemonic=C
+Action.Copy.Name=\u30b3\u30d4\u30fc
+Action.Copy.Desc=\u30ab\u30ec\u30f3\u30c8\u9078\u629e\u3092\u30af\u30ea\u30c3\u30d7\u30dc\u30fc\u30c9\u306b\u30b3\u30d4\u30fc\u3057\u307e\u3059
+
+Action.Cut.Mnemonic=T
+Action.Cut.Name=\u30ab\u30c3\u30c8
+Action.Cut.Desc=\u30ab\u30ec\u30f3\u30c8\u9078\u629e\u3092\u524a\u9664\u3057\u3066\u30af\u30ea\u30c3\u30d7\u30dc\u30fc\u30c9\u306b\u79fb\u3057\u307e\u3059
+
+Action.Delete.Mnemonic=D
+Action.Delete.Name=\u524a\u9664
+Action.Delete.Desc=\u30ab\u30ec\u30f3\u30c8\u9078\u629e\u3092\u524a\u9664\u3057\u307e\u3059
+
+Action.Paste.Mnemonic=P
+Action.Paste.Name=\u8cbc\u308a\u4ed8\u3051
+Action.Paste.Desc=\u30c6\u30ad\u30b9\u30c8\u30d5\u30a1\u30a4\u30eb\u306e\u30ab\u30fc\u30bd\u30eb\u4f4d\u7f6e\u306b\u30af\u30ea\u30c3\u30d7\u30dc\u30fc\u30c9\u306e\u30c6\u30ad\u30b9\u30c8\u3092\u8cbc\u308a\u4ed8\u3051\u307e\u3059
+
+Action.SelectAll.Mnemonic=A
+Action.SelectAll.Name=\u3059\u3079\u3066\u9078\u629e
+Action.SelectAll.Desc=\u30ab\u30ec\u30f3\u30c8\u30c6\u30ad\u30b9\u30c8\u66f8\u985e\u306e\u30c6\u30ad\u30b9\u30c8\u3059\u3079\u3066\u3092\u9078\u629e\u3057\u307e\u3059
+
+Action.Undo.Mnemonic=U
+Action.CantUndo.Name=\u5143\u306b\u623b\u305b\u307e\u305b\u3093
+Action.Undo.Desc=\u524d\u56de\u306e\u30a2\u30af\u30b7\u30e7\u30f3\u3092\u53d6\u308a\u6d88\u3057\u307e\u3059
+
+Action.Redo.Mnemonic=R
+Action.CantRedo.Name=\u518d\u5b9f\u884c\u3067\u304d\u307e\u305b\u3093
+Action.Redo.Desc=\u53d6\u308a\u6d88\u3055\u308c\u305f\u524d\u56de\u306e\u30a2\u30af\u30b7\u30e7\u30f3\u3092\u518d\u9069\u7528\u3057\u307e\u3059
Index: /other-projects/gli-rsyntax-textarea/src/i18n/org/fife/ui/rtextarea/RTextArea_ko.properties
===================================================================
--- /other-projects/gli-rsyntax-textarea/src/i18n/org/fife/ui/rtextarea/RTextArea_ko.properties (revision 25585)
+++ /other-projects/gli-rsyntax-textarea/src/i18n/org/fife/ui/rtextarea/RTextArea_ko.properties (revision 25585)
@@ -0,0 +1,27 @@
+Action.Copy.Mnemonic=C
+Action.Copy.Name=\ubcf5\uc0ac
+Action.Copy.Desc=\ud604\uc7ac\uc758 \uc120\ud0dd\ub41c \ud14d\uc2a4\ud2b8\ub97c \ud074\ub9bd\ubcf4\ub4dc\ub85c \ubcf5\uc0ac\ud55c\ub2e4.
+
+Action.Cut.Mnemonic=T
+Action.Cut.Name=\uc798\ub77c\ub0b4\uae30
+Action.Cut.Desc=\ud604\uc7ac\uc758 \uc120\ud0dd\ub41c \ud14d\uc2a4\ud2b8\ub97c \uc81c\uac70\ud574\uc11c \ud074\ub9bd\ubcf4\ub4dc\ub85c \ubcf5\uc0ac\ud55c\ub2e4.
+
+Action.Delete.Mnemonic=D
+Action.Delete.Name=\uc9c0\uc6b0\uae30
+Action.Delete.Desc=\ud604\uc7ac\uc758 \uc120\ud0dd\ub41c \ud14d\uc2a4\ud2b8\ub97c \uc81c\uac70\ud55c\ub2e4.
+
+Action.Paste.Mnemonic=P
+Action.Paste.Name=\ubd99\uc5ec\ub123\uae30
+Action.Paste.Desc=\ud074\ub9bd\ubcf4\ub4dc\uc5d0 \uc788\ub294 \ud14d\uc2a4\ud2b8\ub97c \ud604\uc7ac\uc758 \uc704\uce58\ub85c \ubd80\ud168 \uc900\ub2e4.
+
+Action.SelectAll.Mnemonic=A
+Action.SelectAll.Name=\uc804\uccb4 \uc120\ud0dd
+Action.SelectAll.Desc=\ud604\uc7ac\uc758 \ud14d\uc2a4\ud2b8 \ud30c\uc77c\uc758 \ubaa8\ub4e0 \ud14d\uc2a4\ud2b8\ub97c \uc120\ud0dd\ud55c\ub2e4.
+
+Action.Undo.Mnemonic=U
+Action.CantUndo.Name=\ucde8\uc18c\ud560\uc218 \uc5c6\uc74c
+Action.Undo.Desc=\ub9c8\uc9c0\ub9c9 action\uc744 \ucde8\uc18c\ud55c\ub2e4.
+
+Action.Redo.Mnemonic=R
+Action.CantRedo.Name=\ub2e4\uc2dc \ud560\uc218 \uc5c6\uc74c
+Action.Redo.Desc=\ucde8\uc18c\ub41c action\uc744 \ub2e4\uc2dc \uc801\uc6a9\ud55c\ub2e4.
Index: /other-projects/gli-rsyntax-textarea/src/i18n/org/fife/ui/rtextarea/RTextArea_nl.properties
===================================================================
--- /other-projects/gli-rsyntax-textarea/src/i18n/org/fife/ui/rtextarea/RTextArea_nl.properties (revision 25585)
+++ /other-projects/gli-rsyntax-textarea/src/i18n/org/fife/ui/rtextarea/RTextArea_nl.properties (revision 25585)
@@ -0,0 +1,27 @@
+Action.Copy.Mnemonic=C
+Action.Copy.Name=Kopi\u00ebren
+Action.Copy.Desc=Kopieert de huidige selectie naar het prikbord.
+
+Action.Cut.Mnemonic=X
+Action.Cut.Name=Knippen
+Action.Cut.Desc=Haalt de huidige selectie weg en plaatst het op het prikbord
+
+Action.Delete.Mnemonic=V
+Action.Delete.Name=Verwijderen
+Action.Delete.Desc=Verwijdert huidige selectie.
+
+Action.Paste.Mnemonic=P
+Action.Paste.Name=Plakken
+Action.Paste.Desc=Plaatst tekst van het prikbordop de huidige locatie in het tekst bestand.
+
+Action.SelectAll.Mnemonic=A
+Action.SelectAll.Name=Alles selecteren
+Action.SelectAll.Desc=Selecteerd alle tekst in het huidige document.
+
+Action.Undo.Mnemonic=U
+Action.CantUndo.Name=Ongedaan maken niet mogelijk
+Action.Undo.Desc=Haalt de laatste actie terug.
+
+Action.Redo.Mnemonic=R
+Action.CantRedo.Name=Opnieuw uitvoeren niet mogelijk
+Action.Redo.Desc=Herhaalt de laatste teruggehaalde actie.
Index: /other-projects/gli-rsyntax-textarea/src/i18n/org/fife/ui/rtextarea/RTextArea_pt_BR.properties
===================================================================
--- /other-projects/gli-rsyntax-textarea/src/i18n/org/fife/ui/rtextarea/RTextArea_pt_BR.properties (revision 25585)
+++ /other-projects/gli-rsyntax-textarea/src/i18n/org/fife/ui/rtextarea/RTextArea_pt_BR.properties (revision 25585)
@@ -0,0 +1,27 @@
+Action.Copy.Mnemonic=C
+Action.Copy.Name=Copiar
+Action.Copy.Desc=Copia o texto selecionado para a \u00e1rea de transfer\u00eancia.
+
+Action.Cut.Mnemonic=T
+Action.Cut.Name=Recortar
+Action.Cut.Desc=Remove o texto selecionado e o coloca na \u00e1rea de transfer\u00eancia.
+
+Action.Delete.Mnemonic=D
+Action.Delete.Name=Excluir
+Action.Delete.Desc=Remove o texto selecionado.
+
+Action.Paste.Mnemonic=P
+Action.Paste.Name=Colar
+Action.Paste.Desc=Coloca o texto da \u00e1rea de transfer\u00eancia na posi\u00e7\u00e3o atual do arquivo.
+
+Action.SelectAll.Mnemonic=A
+Action.SelectAll.Name=Selecionar Tudo
+Action.SelectAll.Desc=Seleciona todo o texto no documento de texto atual.
+
+Action.Undo.Mnemonic=U
+Action.CantUndo.Name=Imposs\u00edvel Desfazer
+Action.Undo.Desc=Desfaz a \u00faltima a\u00e7\u00e3o.
+
+Action.Redo.Mnemonic=R
+Action.CantRedo.Name=Imposs\u00edvel Refazer
+Action.Redo.Desc=Refaz a \u00faltima a\u00e7\u00e3o desfeita.
Index: /other-projects/gli-rsyntax-textarea/src/i18n/org/fife/ui/rtextarea/RTextArea_ru.properties
===================================================================
--- /other-projects/gli-rsyntax-textarea/src/i18n/org/fife/ui/rtextarea/RTextArea_ru.properties (revision 25585)
+++ /other-projects/gli-rsyntax-textarea/src/i18n/org/fife/ui/rtextarea/RTextArea_ru.properties (revision 25585)
@@ -0,0 +1,27 @@
+Action.Copy.Mnemonic=\u041a
+Action.Copy.Name=\u041a\u043e\u043f\u0438\u0440\u043e\u0432\u0430\u0442\u044c
+Action.Copy.Desc=\u041a\u043e\u043f\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0432\u044b\u0434\u0435\u043b\u0435\u043d\u043d\u043e\u0433\u043e \u0444\u0440\u0430\u0433\u043c\u0435\u043d\u0442\u0430 \u0432 \u0431\u0443\u0444\u0435\u0440 \u043e\u0431\u043c\u0435\u043d\u0430.
+
+Action.Cut.Mnemonic=\u0412
+Action.Cut.Name=\u0412\u044b\u0440\u0435\u0437\u0430\u0442\u044c
+Action.Cut.Desc=\u0423\u0434\u0430\u043b\u0435\u043d\u0438\u0435 \u0432\u044b\u0434\u0435\u043b\u0435\u043d\u043d\u043e\u0433\u043e \u0444\u0440\u0430\u0433\u043c\u0435\u043d\u0442\u0430 \u0438 \u043f\u043e\u043c\u0435\u0449\u0435\u043d\u0438\u0435 \u0435\u0433\u043e \u0432 \u0431\u0443\u0444\u0435\u0440 \u043e\u0431\u043c\u0435\u043d\u0430.
+
+Action.Delete.Mnemonic=\u0423
+Action.Delete.Name=\u0423\u0434\u0430\u043b\u0438\u0442\u044c
+Action.Delete.Desc=\u0423\u0434\u0430\u043b\u0435\u043d\u0438\u0435 \u0432\u044b\u0434\u0435\u043b\u0435\u043d\u043d\u043e\u0433\u043e \u0444\u0440\u0430\u0433\u043c\u0435\u043d\u0442\u0430.
+
+Action.Paste.Mnemonic=\u0421
+Action.Paste.Name=\u0412\u0441\u0442\u0430\u0432\u0438\u0442\u044c
+Action.Paste.Desc=\u0420\u0430\u0437\u043c\u0435\u0449\u0435\u043d\u0438\u0435 \u0442\u0435\u043a\u0441\u0442\u0430 \u0438\u0437 \u0431\u0443\u0444\u0435\u0440\u0430 \u043e\u0431\u043c\u0435\u043d\u0430 \u0432 \u0442\u0435\u043a\u0443\u0449\u0443\u044e \u043f\u043e\u0437\u0438\u0446\u0438\u044e \u0432 \u0444\u0430\u0439\u043b\u0435.
+
+Action.SelectAll.Mnemonic=\u042b
+Action.SelectAll.Name=\u0412\u044b\u0431\u0440\u0430\u0442\u044c \u0432\u0441\u0435
+Action.SelectAll.Desc=\u0412\u044b\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u0432\u0441\u0435\u0433\u043e \u0442\u0435\u043a\u0441\u0442\u0430 \u0432 \u0442\u0435\u043a\u0443\u0449\u0435\u043c \u0444\u0430\u0439\u043b\u0435.
+
+Action.Undo.Mnemonic=U
+Action.CantUndo.Name=\u041e\u0442\u043c\u0435\u043d\u0430 \u043d\u0435\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u0430
+Action.Undo.Desc=\u041e\u0442\u043a\u0430\u0442 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0435\u0433\u043e \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0435.
+
+Action.Redo.Mnemonic=R
+Action.CantRedo.Name=\u041f\u043e\u0432\u0442\u043e\u0440 \u043d\u0435\u0432\u043e\u0437\u043c\u043e\u0436\u0435\u043d
+Action.Redo.Desc=\u0412\u044b\u0437\u043e\u0432 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0435\u0433\u043e \u043e\u0442\u043c\u0435\u043d\u0435\u043d\u043d\u043e\u0433\u043e \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f.
Index: /other-projects/gli-rsyntax-textarea/src/i18n/org/fife/ui/rtextarea/RTextArea_tr.properties
===================================================================
--- /other-projects/gli-rsyntax-textarea/src/i18n/org/fife/ui/rtextarea/RTextArea_tr.properties (revision 25585)
+++ /other-projects/gli-rsyntax-textarea/src/i18n/org/fife/ui/rtextarea/RTextArea_tr.properties (revision 25585)
@@ -0,0 +1,27 @@
+Action.Copy.Mnemonic=K
+Action.Copy.Name=Kopyala
+Action.Copy.Desc=Secileni ClipBoarda Kopyalar.
+
+Action.Cut.Mnemonic=X
+Action.Cut.Name=Kes
+Action.Cut.Desc=Secileni Kaldirip ClipBoarda Yerlestirir.
+
+Action.Delete.Mnemonic=S
+Action.Delete.Name=Sil
+Action.Delete.Desc=Secileni Kaldir.
+
+Action.Paste.Mnemonic=Y
+Action.Paste.Name=Yapistir
+Action.Paste.Desc=Metni Metin Dosyasindaki Su Anki Yere Yapistir.
+
+Action.SelectAll.Mnemonic=T
+Action.SelectAll.Name=Tumunu Sec
+Action.SelectAll.Desc=Metin Belgesindeki Butun Metini Secer.
+
+Action.Undo.Mnemonic=U
+Action.CantUndo.Name=Geri Alinamaz
+Action.Undo.Desc=Son Eylemi Geri Alir.
+
+Action.Redo.Mnemonic=R
+Action.CantRedo.Name=Yeniden Yapilamaz
+Action.Redo.Desc=Geri Alinan Eylemi Yeniden Uygular.
Index: /other-projects/gli-rsyntax-textarea/src/i18n/org/fife/ui/rtextarea/RTextArea_zh_CN.properties
===================================================================
--- /other-projects/gli-rsyntax-textarea/src/i18n/org/fife/ui/rtextarea/RTextArea_zh_CN.properties (revision 25585)
+++ /other-projects/gli-rsyntax-textarea/src/i18n/org/fife/ui/rtextarea/RTextArea_zh_CN.properties (revision 25585)
@@ -0,0 +1,30 @@
+#Version History
+#Version Date Author Contact
+# create 2006-4-14 SunYi SonYiChi@gmail.com
+Action.Copy.Mnemonic=C
+Action.Copy.Name=\u590d\u5236
+Action.Copy.Desc=\u5c06\u5f53\u524d\u9009\u62e9\u590d\u5236\u5230\u526a\u8d34\u677f.
+
+Action.Cut.Mnemonic=T
+Action.Cut.Name=\u526a\u5207
+Action.Cut.Desc=\u5c06\u5f53\u524d\u9009\u62e9\u590d\u5236\u5230\u526a\u8d34\u677f\u5e76\u4ece\u6587\u672c\u533a\u57df\u5220\u9664.
+
+Action.Delete.Mnemonic=D
+Action.Delete.Name=\u5220\u9664
+Action.Delete.Desc=\u5220\u9664\u5f53\u524d\u9009\u62e9\u533a\u57df.
+
+Action.Paste.Mnemonic=P
+Action.Paste.Name=\u7c98\u8d34
+Action.Paste.Desc=\u5c06\u5f53\u524d\u526a\u8d34\u677f\u5185\u5bb9\u590d\u5236\u5230\u6587\u672c\u533a\u57df.
+
+Action.SelectAll.Mnemonic=A
+Action.SelectAll.Name=\u5168\u9009
+Action.SelectAll.Desc=\u9009\u62e9\u5f53\u524d\u6587\u6863\u4e2d\u5168\u90e8\u5185\u5bb9.
+
+Action.Undo.Mnemonic=U
+Action.CantUndo.Name=\u65e0\u6cd5\u64a4\u9500
+Action.Undo.Desc=\u64a4\u9500\u4e0a\u6b21\u64cd\u4f5c.
+
+Action.Redo.Mnemonic=R
+Action.CantRedo.Name=\u65e0\u6cd5\u91cd\u590d
+Action.Redo.Desc=\u6267\u884c\u4e0b\u4e2a\u64cd\u4f5c.
Index: /other-projects/gli-rsyntax-textarea/src/i18n/org/fife/ui/rtextarea/RTextArea_zh_TW.properties
===================================================================
--- /other-projects/gli-rsyntax-textarea/src/i18n/org/fife/ui/rtextarea/RTextArea_zh_TW.properties (revision 25585)
+++ /other-projects/gli-rsyntax-textarea/src/i18n/org/fife/ui/rtextarea/RTextArea_zh_TW.properties (revision 25585)
@@ -0,0 +1,27 @@
+Action.Copy.Mnemonic=C
+Action.Copy.Name=\u8907\u88fd
+Action.Copy.Desc=\u62f7\u8c9d\u73fe\u9078\u9805\u5165\u526a\u8cbc\u677f.
+
+Action.Cut.Mnemonic=T
+Action.Cut.Name=\u526a\u5207
+Action.Cut.Desc=\u522a\u9664\u9078\u64c7\u4e26\u653e\u5165\u526a\u8cbc\u677f.
+
+Action.Delete.Mnemonic=D
+Action.Delete.Name=\u522a\u9664
+Action.Delete.Desc=\u522a\u9664\u7576\u524d\u9078\u9805.
+
+Action.Paste.Mnemonic=P
+Action.Paste.Name=\u7c98\u8cbc
+Action.Paste.Desc=\u5c07\u526a\u8cbc\u677f\u4e2d\u7684\u6587\u672c\u653e\u5165\u7576\u524d\u4f4d\u7f6e.
+
+Action.SelectAll.Mnemonic=A
+Action.SelectAll.Name=\u5168\u9078
+Action.SelectAll.Desc=\u5168\u9078\u73fe\u6a94\u6848\u6240\u6709\u6587\u5b57.
+
+Action.Undo.Mnemonic=U
+Action.CantUndo.Name=\u7121\u6cd5\u64a4\u92b7
+Action.Undo.Desc=\u53d6\u6d88\u6700\u5f8c\u4e00\u6b21\u884c\u52d5.
+
+Action.Redo.Mnemonic=R
+Action.CantRedo.Name=\u7121\u6cd5\u91cd\u505a
+Action.Redo.Desc=\u91cd\u8907\u6700\u5f8c\u53d6\u6d88\u7684\u884c\u52d5.
Index: /other-projects/gli-rsyntax-textarea/src/java/org/fife/io/DocumentReader.java
===================================================================
--- /other-projects/gli-rsyntax-textarea/src/java/org/fife/io/DocumentReader.java (revision 25585)
+++ /other-projects/gli-rsyntax-textarea/src/java/org/fife/io/DocumentReader.java (revision 25585)
@@ -0,0 +1,209 @@
+/*
+ * 02/24/2004
+ *
+ * DocumentReader.java - A reader for javax.swing.text.Document
+ * objects.
+ *
+ * This library is distributed under a modified BSD license. See the included
+ * RSyntaxTextArea.License.txt file for details.
+ */
+package org.fife.io;
+
+import java.io.Reader;
+import javax.swing.text.BadLocationException;
+import javax.swing.text.Document;
+import javax.swing.text.Segment;
+
+
+/**
+ * A Reader
for javax.swing.text.Document
objects.
+ *
+ * @author Robert Futrell
+ * @version 1.0
+ */
+public class DocumentReader extends Reader {
+
+ /**
+ * The stream's position in the document.
+ */
+ private long position;
+
+ /**
+ * A remembered position in the document.
+ */
+ private long mark;
+
+ /**
+ * The document we're working on.
+ */
+ private Document document;
+
+ /**
+ * Used for fast character access.
+ */
+ private Segment segment;
+
+
+ /**
+ * Constructor.
+ *
+ * @param document The document we're 'reading'.
+ */
+ public DocumentReader(Document document) {
+ position = 0;
+ mark = -1;
+ this.document = document;
+ this.segment = new Segment();
+ }
+
+
+ /**
+ * This currently does nothing...
+ */
+ public void close() {
+ }
+
+
+ /**
+ * Marks the present position in the stream. Subsequent calls to
+ * reset()
will reposition the stream to this point.
+ *
+ * @param readAheadLimit Ignored.
+ */
+ public void mark(int readAheadLimit) {
+ mark = position;
+ }
+
+
+ /**
+ * Tells whether this reader supports the mark
operation.
+ * This always returns true
for DocumentReader
.
+ */
+ public boolean markSupported() {
+ return true;
+ }
+
+
+ /**
+ * Reads the single character at the current position in the document.
+ */
+ public int read() {
+ if(position>=document.getLength()) {
+ return -1; // Read past end of document.
+ }
+ try {
+ document.getText((int)position,1, segment);
+ position++;
+ return segment.array[segment.offset];
+ } catch (BadLocationException ble) {
+ /* Should never happen?? */
+ ble.printStackTrace();
+ return -1;
+ }
+ }
+
+
+ /**
+ * Read array.length
characters from the beginning
+ * of the document into array
.
+ *
+ * @param array The array to read characters into.
+ * @return The number of characters read.
+ */
+ public int read(char array[]) {
+ return read(array, 0, array.length);
+ }
+
+
+ /**
+ * Reads characters into a portion of an array.
+ *
+ * @param cbuf The destination buffer.
+ * @param off Offset at which to start storing characters.
+ * @param len Maximum number of characters to read.
+ * @return The number of characters read, or -1
if the
+ * end of the stream (document) has been reached.
+ */
+ public int read(char cbuf[], int off, int len) {
+ int k;
+ if(position>=document.getLength()) {
+ return -1; // Read past end of document.
+ }
+ k = len;
+ if((position+k)>=document.getLength())
+ k = document.getLength() - (int)position;
+ if(off + k >= cbuf.length)
+ k = cbuf.length - off;
+ try {
+ document.getText((int)position, k, segment);
+ position += k;
+ System.arraycopy(segment.array,segment.offset,
+ cbuf,off,
+ k);
+ return k;
+ } catch (BadLocationException ble) {
+ /* Should never happen ? */
+ return -1;
+ }
+ }
+
+
+ /**
+ * Tells whether this reader is ready to be read without
+ * blocking for input. DocumentReader
will
+ * always return true.
+ *
+ * @return true
if the next read operation will
+ * return without blocking.
+ */
+ public boolean ready() {
+ return true;
+ }
+
+
+ /**
+ * Resets the stream. If the stream has been marked, then attempt to
+ * reposition it at the mark. If the stream has not been marked, then
+ * move it to the beginning of the document.
+ */
+ public void reset() {
+ if(mark==-1) {
+ position = 0;
+ }
+ else {
+ position = mark;
+ mark = -1;
+ }
+ }
+
+
+ /**
+ * Skips characters. This will not 'skip' past the end of the document.
+ *
+ * @param n The number of characters to skip.
+ * @return The number of characters actually skipped.
+ */
+ public long skip(long n) {
+ if (position+n<=document.getLength()) {
+ position += n;
+ return n;
+ }
+ long temp = position;
+ position = document.getLength();
+ return document.getLength() - temp;
+ }
+
+
+ /**
+ * Move to the specified position in the document. If pos
+ * is greater than the document's length, the stream's position is moved
+ * to the end of the document.
+ *
+ * @param pos The position in the document to move to.
+ */
+ public void seek(long pos) {
+ position = Math.min(pos, document.getLength());
+ }
+
+
+}
Index: /other-projects/gli-rsyntax-textarea/src/java/org/fife/io/UnicodeReader.java
===================================================================
--- /other-projects/gli-rsyntax-textarea/src/java/org/fife/io/UnicodeReader.java (revision 25585)
+++ /other-projects/gli-rsyntax-textarea/src/java/org/fife/io/UnicodeReader.java (revision 25585)
@@ -0,0 +1,268 @@
+/*
+ * 09/23/2004
+ *
+ * UnicodeReader.java - A reader for Unicode input streams that is capable of
+ * discerning which particular encoding is being used via the BOM.
+ *
+ * This library is distributed under a modified BSD license. See the included
+ * RSyntaxTextArea.License.txt file for details.
+ */
+package org.fife.io;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.io.IOException;
+import java.io.PushbackInputStream;
+import java.io.Reader;
+
+
+/**
+ * A reader capable of identifying Unicode streams by their BOMs. This class
+ * will recognize the following encodings:
+ *
+ * - UTF-8
+ *
- UTF-16LE
+ *
- UTF-16BE
+ *
- UTF-32LE
+ *
- UTF-32BE
+ *
+ * If the stream is not found to be any of the above, then a default encoding
+ * is used for reading. The user can specify this default encoding, or a system
+ * default will be used.
+ *
+ * For optimum performance, it is recommended that you wrap all instances of
+ * UnicodeReader
with a java.io.BufferedReader
.
+ *
+ * This class is mostly ripped off from the workaround in the description of
+ * Java Bug 4508058.
+ *
+ * @author Robert Futrell
+ * @version 0.9
+ */
+public class UnicodeReader extends Reader {
+
+ /**
+ * The input stream from which we're really reading.
+ */
+ private InputStreamReader internalIn = null;
+
+ /**
+ * The encoding being used. We keep our own instead of using the string
+ * returned by java.io.InputStreamReader
since that class
+ * does not return user-friendly names.
+ */
+ private String encoding;
+
+ /**
+ * The size of a BOM.
+ */
+ private static final int BOM_SIZE = 4;
+
+
+ /**
+ * This utility constructor is here because you will usually use a
+ * UnicodeReader
on files.
+ * Creates a reader using the encoding specified by the BOM in the file;
+ * if there is no recognized BOM, then a system default encoding is used.
+ *
+ * @param file The file from which you want to read.
+ * @throws IOException If an error occurs when checking for/reading the
+ * BOM.
+ * @throws FileNotFoundException If the file does not exist, is a
+ * directory, or cannot be opened for reading.
+ * @throws SecurityException If a security manager exists and its
+ * checkRead method denies read access to the file.
+ */
+ public UnicodeReader(String file) throws IOException,
+ FileNotFoundException, SecurityException {
+ this(new File(file));
+ }
+
+
+ /**
+ * This utility constructor is here because you will usually use a
+ * UnicodeReader
on files.
+ * Creates a reader using the encoding specified by the BOM in the file;
+ * if there is no recognized BOM, then a system default encoding is used.
+ *
+ * @param file The file from which you want to read.
+ * @throws IOException If an error occurs when checking for/reading the
+ * BOM.
+ * @throws FileNotFoundException If the file does not exist, is a
+ * directory, or cannot be opened for reading.
+ * @throws SecurityException If a security manager exists and its
+ * checkRead method denies read access to the file.
+ */
+ public UnicodeReader(File file) throws IOException, FileNotFoundException,
+ SecurityException {
+ this(new FileInputStream(file));
+ }
+
+
+ /**
+ * This utility constructor is here because you will usually use a
+ * UnicodeReader
on files.
+ * Creates a reader using the encoding specified by the BOM in the file;
+ * if there is no recognized BOM, then a specified default encoding is
+ * used.
+ *
+ * @param file The file from which you want to read.
+ * @param defaultEncoding The encoding to use if no BOM is found. If
+ * this value is null
, a system default is used.
+ * @throws IOException If an error occurs when checking for/reading the
+ * BOM.
+ * @throws FileNotFoundException If the file does not exist, is a
+ * directory, or cannot be opened for reading.
+ * @throws SecurityException If a security manager exists and its
+ * checkRead method denies read access to the file.
+ */
+ public UnicodeReader(File file, String defaultEncoding)
+ throws IOException, FileNotFoundException,
+ SecurityException {
+ this(new FileInputStream(file), defaultEncoding);
+ }
+
+
+ /**
+ * Creates a reader using the encoding specified by the BOM in the file;
+ * if there is no recognized BOM, then a system default encoding is used.
+ *
+ * @param in The input stream from which to read.
+ * @throws IOException If an error occurs when checking for/reading the
+ * BOM.
+ */
+ public UnicodeReader(InputStream in) throws IOException {
+ this(in, null);
+ }
+
+
+ /**
+ * Creates a reader using the encoding specified by the BOM in the file;
+ * if there is no recognized BOM, then defaultEncoding
is
+ * used.
+ *
+ * @param in The input stream from which to read.
+ * @param defaultEncoding The encoding to use if no recognized BOM is
+ * found. If this value is null
, a system default
+ * is used.
+ * @throws IOException If an error occurs when checking for/reading the
+ * BOM.
+ */
+ public UnicodeReader(InputStream in, String defaultEncoding)
+ throws IOException {
+ init(in, defaultEncoding);
+ }
+
+
+ /**
+ * Closes this reader.
+ */
+ public void close() throws IOException {
+ internalIn.close();
+ }
+
+
+ /**
+ * Returns the encoding being used to read this input stream (i.e., the
+ * encoding of the file). If a BOM was recognized, then the specific
+ * Unicode type is returned; otherwise, either the default encoding passed
+ * into the constructor or the system default is returned.
+ *
+ * @return The encoding of the stream.
+ */
+ public String getEncoding() {
+ return encoding;
+ }
+
+
+ /**
+ * Read-ahead four bytes and check for BOM marks. Extra bytes are
+ * unread back to the stream, only BOM bytes are skipped.
+ *
+ * @param defaultEncoding The encoding to use if no BOM was recognized. If
+ * this value is null
, then a system default is used.
+ * @throws IOException If an error occurs when trying to read a BOM.
+ */
+ protected void init(InputStream in, String defaultEncoding)
+ throws IOException {
+
+ PushbackInputStream tempIn = new PushbackInputStream(in, BOM_SIZE);
+
+ byte bom[] = new byte[BOM_SIZE];
+ int n, unread;
+ n = tempIn.read(bom, 0, bom.length);
+
+ if ((bom[0]==(byte)0x00) && (bom[1]==(byte)0x00) &&
+ (bom[2]==(byte)0xFE) && (bom[3]==(byte)0xFF)) {
+ encoding = "UTF-32BE";
+ unread = n - 4;
+ }
+
+ else if (n==BOM_SIZE && // Last 2 bytes are 0; could be an empty UTF-16
+ (bom[0]==(byte)0xFF) && (bom[1]==(byte)0xFE) &&
+ (bom[2]==(byte)0x00) && (bom[3]==(byte)0x00)) {
+ encoding = "UTF-32LE";
+ unread = n - 4;
+ }
+
+ else if ((bom[0]==(byte)0xEF) &&
+ (bom[1]==(byte)0xBB) &&
+ (bom[2]==(byte)0xBF)) {
+ encoding = "UTF-8";
+ unread = n - 3;
+ }
+
+ else if ((bom[0]==(byte)0xFE) && (bom[1] == (byte)0xFF)) {
+ encoding = "UTF-16BE";
+ unread = n - 2;
+ }
+
+ else if ((bom[0]==(byte)0xFF) && (bom[1]== (byte)0xFE)) {
+ encoding = "UTF-16LE";
+ unread = n - 2;
+ }
+
+ else {
+ // Unicode BOM mark not found, unread all bytes
+ encoding = defaultEncoding;
+ unread = n;
+ }
+
+ if (unread > 0)
+ tempIn.unread(bom, (n - unread), unread);
+ else if (unread < -1)
+ tempIn.unread(bom, 0, 0);
+
+ // Use given encoding
+ if (encoding == null) {
+ internalIn = new InputStreamReader(tempIn);
+ encoding = internalIn.getEncoding(); // Get the default.
+ }
+ else {
+ internalIn = new InputStreamReader(tempIn, encoding);
+ }
+
+ }
+
+
+ /**
+ * Read characters into a portion of an array. This method will block until
+ * some input is available, an I/O error occurs, or the end of the stream
+ * is reached.
+ *
+ * @param cbuf The buffer into which to read.
+ * @param off The offset at which to start storing characters.
+ * @param len The maximum number of characters to read.
+ *
+ * @return The number of characters read, or -1
if the end
+ * of the stream has been reached.
+ */
+ public int read(char[] cbuf, int off, int len) throws IOException {
+ return internalIn.read(cbuf, off, len);
+ }
+
+
+}
Index: /other-projects/gli-rsyntax-textarea/src/java/org/fife/io/UnicodeWriter.java
===================================================================
--- /other-projects/gli-rsyntax-textarea/src/java/org/fife/io/UnicodeWriter.java (revision 25585)
+++ /other-projects/gli-rsyntax-textarea/src/java/org/fife/io/UnicodeWriter.java (revision 25585)
@@ -0,0 +1,253 @@
+/*
+ * 09/24/2004
+ *
+ * UnicodeWriter.java - Writes Unicode output with the proper BOM.
+ *
+ * This library is distributed under a modified BSD license. See the included
+ * RSyntaxTextArea.License.txt file for details.
+ */
+package org.fife.io;
+
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.OutputStream;
+import java.io.OutputStreamWriter;
+import java.io.UnsupportedEncodingException;
+import java.io.Writer;
+
+
+/**
+ * Writes Unicode text to an output stream. If the specified encoding is a
+ * Unicode, then the text is preceeded by the proper Unicode BOM. If it is any
+ * other encoding, this class behaves just like OutputStreamWriter
.
+ * This class is here because Java's OutputStreamWriter
apparently
+ * doesn't believe in writing BOMs.
+ *
+ *
+ * For optimum performance, it is recommended that you wrap all instances of
+ * UnicodeWriter
with a java.io.BufferedWriter
.
+ *
+ * @author Robert Futrell
+ * @version 0.7
+ */
+public class UnicodeWriter extends Writer {
+
+ /**
+ * If this system property evaluates to "false
", ignoring
+ * case, files written out as UTF-8 will not have a BOM written for them.
+ * Otherwise (even if the property is not set), UTF-8 files will have a
+ * BOM written.
+ */
+ public static final String PROPERTY_WRITE_UTF8_BOM =
+ "UnicodeWriter.writeUtf8BOM";
+
+
+ /**
+ * The writer actually doing the writing.
+ */
+ private OutputStreamWriter internalOut;
+
+ private static final byte[] UTF8_BOM = new byte[] {
+ (byte)0xEF,
+ (byte)0xBB,
+ (byte)0xBF
+ };
+
+ private static final byte[] UTF16LE_BOM = new byte[] {
+ (byte)0xFF,
+ (byte)0xFE
+ };
+
+ private static final byte[] UTF16BE_BOM = new byte[] {
+ (byte)0xFE,
+ (byte)0xFF
+ };
+
+ private static final byte[] UTF32LE_BOM = new byte[] {
+ (byte)0xFF,
+ (byte)0xFE,
+ (byte)0x00,
+ (byte)0x00
+ };
+
+ private static final byte[] UTF32BE_BOM = new byte[] {
+ (byte)0x00,
+ (byte)0x00,
+ (byte)0xFE,
+ (byte)0xFF
+ };
+
+
+ /**
+ * This is a utility constructor since the vast majority of the time, this
+ * class will be used to write Unicode files.
+ *
+ * @param fileName The file to which to write the Unicode output.
+ * @param encoding The encoding to use.
+ * @throws UnsupportedEncodingException If the specified encoding is not
+ * supported.
+ * @throws IOException If an IO exception occurs.
+ */
+ public UnicodeWriter(String fileName, String encoding)
+ throws UnsupportedEncodingException, IOException {
+ this(new FileOutputStream(fileName), encoding);
+ }
+
+
+
+ /**
+ * This is a utility constructor since the vast majority of the time, this
+ * class will be used to write Unicode files.
+ *
+ * @param file The file to which to write the Unicode output.
+ * @param encoding The encoding to use.
+ * @throws UnsupportedEncodingException If the specified encoding is not
+ * supported.
+ * @throws IOException If an IO exception occurs.
+ */
+ public UnicodeWriter(File file, String encoding)
+ throws UnsupportedEncodingException, IOException {
+ this(new FileOutputStream(file), encoding);
+ }
+
+
+
+ /**
+ * Creates a new writer.
+ *
+ * @param out The output stream to write.
+ * @param encoding The encoding to use.
+ * @throws UnsupportedEncodingException If the specified encoding is not
+ * supported.
+ * @throws IOException If an IO exception occurs.
+ */
+ public UnicodeWriter(OutputStream out, String encoding)
+ throws UnsupportedEncodingException, IOException {
+ init(out, encoding);
+ }
+
+
+ /**
+ * Closes this writer.
+ *
+ * @throws IOException If an IO exception occurs.
+ */
+ public void close() throws IOException {
+ internalOut.close();
+ }
+
+
+ /**
+ * Flushes the stream.
+ *
+ * @throws IOException If an IO exception occurs.
+ */
+ public void flush() throws IOException {
+ internalOut.flush();
+ }
+
+
+ /**
+ * Returns the encoding being used to write this output stream (i.e., the
+ * encoding of the file).
+ *
+ * @return The encoding of the stream.
+ */
+ public String getEncoding() {
+ return internalOut.getEncoding();
+ }
+
+
+ /**
+ * Returns whether UTF-8 files should have a BOM in them when written.
+ *
+ * @return Whether to write a BOM for UTF-8 files.
+ */
+ public static boolean getWriteUtf8BOM() {
+ String prop = System.getProperty(PROPERTY_WRITE_UTF8_BOM);
+ if (prop!=null && Boolean.valueOf(prop).equals(Boolean.FALSE)) {
+ return false;
+ }
+ return true;
+ }
+
+
+ /**
+ * Initializes the internal output stream and writes the BOM if the
+ * specified encoding is a Unicode encoding.
+ *
+ * @param out The output stream we are writing.
+ * @param encoding The encoding in which to write.
+ * @throws UnsupportedEncodingException If the specified encoding isn't
+ * supported.
+ * @throws IOException If an I/O error occurs while writing a BOM.
+ */
+ private void init(OutputStream out, String encoding)
+ throws UnsupportedEncodingException, IOException {
+
+ internalOut = new OutputStreamWriter(out, encoding);
+
+ // Write the proper BOM if they specified a Unicode encoding.
+ // NOTE: Creating an OutputStreamWriter with encoding "UTF-16" DOES
+ // DOES write out the BOM; "UTF-16LE", "UTF-16BE", "UTF-32", "UTF-32LE"
+ // and "UTF-32BE" don't.
+ if ("UTF-8".equals(encoding)) {
+ if (getWriteUtf8BOM()) {
+ out.write(UTF8_BOM, 0, UTF8_BOM.length);
+ }
+ }
+ else if ("UTF-16LE".equals(encoding)) {
+ out.write(UTF16LE_BOM, 0, UTF16LE_BOM.length);
+ }
+ else if (/*"UTF-16".equals(encoding) || */"UTF-16BE".equals(encoding)) {
+ out.write(UTF16BE_BOM, 0, UTF16BE_BOM.length);
+ }
+ else if ("UTF-32LE".equals(encoding)) {
+ out.write(UTF32LE_BOM, 0, UTF32LE_BOM.length);
+ }
+ else if ("UTF-32".equals(encoding) || "UTF-32BE".equals(encoding)) {
+ out.write(UTF32BE_BOM, 0, UTF32BE_BOM.length);
+ }
+
+ }
+
+
+ /**
+ * Writes a portion of an array of characters.
+ *
+ * @param cbuf The buffer of characters.
+ * @param off The offset from which to start writing characters.
+ * @param len The number of characters to write.
+ * @throws IOException If an I/O error occurs.
+ */
+ public void write(char[] cbuf, int off, int len) throws IOException {
+ internalOut.write(cbuf, off, len);
+ }
+
+
+ /**
+ * Writes a single character.
+ *
+ * @param c An integer specifying the character to write.
+ * @throws IOException If an IO error occurs.
+ */
+ public void write(int c) throws IOException {
+ internalOut.write(c);
+ }
+
+
+ /**
+ * Writes a portion of a string.
+ *
+ * @param str The string from which to write.
+ * @param off The offset from which to start writing characters.
+ * @param len The number of characters to write.
+ * @throws IOException If an IO error occurs.
+ */
+ public void write(String str, int off, int len) throws IOException {
+ internalOut.write(str, off, len);
+ }
+
+
+}
Index: /other-projects/gli-rsyntax-textarea/src/java/org/fife/io/package.html
===================================================================
--- /other-projects/gli-rsyntax-textarea/src/java/org/fife/io/package.html (revision 25585)
+++ /other-projects/gli-rsyntax-textarea/src/java/org/fife/io/package.html (revision 25585)
@@ -0,0 +1,5 @@
+
+
+ Utility I/O classes.
+
+
Index: /other-projects/gli-rsyntax-textarea/src/java/org/fife/print/RPrintUtilities.java
===================================================================
--- /other-projects/gli-rsyntax-textarea/src/java/org/fife/print/RPrintUtilities.java (revision 25585)
+++ /other-projects/gli-rsyntax-textarea/src/java/org/fife/print/RPrintUtilities.java (revision 25585)
@@ -0,0 +1,530 @@
+/*
+ * 11/14/2003
+ *
+ * RPrintUtilities.java - A collection of static methods useful for printing
+ * text from Swing text components.
+ *
+ * This library is distributed under a modified BSD license. See the included
+ * RSyntaxTextArea.License.txt file for details.
+ */
+package org.fife.print;
+
+import javax.swing.text.BadLocationException;
+import javax.swing.text.Document;
+import javax.swing.text.Element;
+import javax.swing.text.Segment;
+import javax.swing.text.JTextComponent;
+import javax.swing.text.TabExpander;
+import javax.swing.text.Utilities;
+import java.awt.Color;
+import java.awt.Font;
+import java.awt.FontMetrics;
+import java.awt.Graphics;
+import java.awt.print.*;
+
+
+
+/**
+ * A collection of static methods useful for printing text from Swing text components.
+ *
+ * @author Robert Futrell
+ * @version 1.0
+ */
+public abstract class RPrintUtilities {
+
+ private static int currentDocLineNumber; // The line number in the document we are currently on.
+ private static int numDocLines; // The number of lines in the current document.
+ private static Element rootElement; // The first Element (line) in the current document.
+
+ // The characters at which to break a line if implementing word wrap.
+ private static final char [] breakChars = { ' ', '\t', ',', '.', ';', '?', '!' };
+
+ // These variables are 'global' because RPrintTabExpander uses them.
+ private static int xOffset; // The x-offset (for the page margin) when printing.
+ private static int tabSizeInSpaces; // The length of a tab, in spaces.
+ private static FontMetrics fm; // The metrics of the font currently being used to print.
+
+
+ /**
+ * Returns the position closest to, but before, position maxCharsPerLine
in
+ * line
of one of the chars in breakChars
, or simply returns
+ * maxCharsPerLine-1
if none of the breakChars
comes before
+ * that position. This position represents the logical line break for this java.lang.String
+ * if it is being printed in a monospaced font when lines can only be maxCharsPerLine
+ * characters long.
+ *
+ * @param line The text being printed.
+ * @param maxCharsPerLine Only up-to this many characters from
+ * line
can be printed on one line.
+ * @return The logical position at which to stop printing line
+ * to simulate word wrap.
+ */
+ private static int getLineBreakPoint(String line, final int maxCharsPerLine) {
+
+ int breakPoint = -1;
+ for (int i=0; i breakPoint)
+ breakPoint = breakCharPos;
+ }
+
+ return (breakPoint==-1 ? maxCharsPerLine-1 : breakPoint);
+
+ }
+
+
+ /**
+ * Prints a Document
using a monospaced font, and does no word wrapping (ie,
+ * words will wrap mid-word to the next line). This method is expected to be called from
+ * Printable 'print(Graphics g)' functions.
+ *
+ * @param g The graphics context to write to.
+ * @param doc The javax.swing.text.Document
to print.
+ * @param fontSize the point size to use for the monospaced font.
+ * @param pageIndex The page number to print.
+ * @param pageFormat The format to print the page with.
+ * @param tabSize The number of spaces to expand tabs to.
+ *
+ * @see #printDocumentMonospacedWordWrap
+ */
+ public static int printDocumentMonospaced(Graphics g, Document doc, int fontSize, int pageIndex,
+ PageFormat pageFormat, int tabSize) {
+
+ g.setColor(Color.BLACK);
+ g.setFont(new Font("Monospaced", Font.PLAIN, fontSize));
+
+ // Initialize our static variables (these are used by our tab expander below).
+ tabSizeInSpaces = tabSize;
+ fm = g.getFontMetrics();
+
+ // Create our tab expander.
+ //RPrintTabExpander tabExpander = new RPrintTabExpander();
+
+ // Get width and height of characters in this monospaced font.
+ int fontWidth = fm.charWidth('w'); // Any character will do as font is monospaced.
+ int fontHeight = fm.getHeight();
+
+ int MAX_CHARS_PER_LINE = (int)pageFormat.getImageableWidth() / fontWidth;
+ int MAX_LINES_PER_PAGE = (int)pageFormat.getImageableHeight() / fontHeight;
+
+ final int STARTING_LINE_NUMBER = MAX_LINES_PER_PAGE * pageIndex;
+
+ // The (x,y) coordinate to print at (in pixels, not characters).
+ // Since y is the baseline of where we'll start printing (not the top-left
+ // corner), we offset it by the font's ascent ( + 1 just for good measure).
+ xOffset = (int)pageFormat.getImageableX();
+ int y = (int)pageFormat.getImageableY() + fm.getAscent() + 1;
+
+ // A counter to keep track of the number of lines that WOULD HAVE been
+ // printed if we were printing all lines.
+ int numPrintedLines = 0;
+
+ // Keep going while there are more lines in the document.
+ currentDocLineNumber = 0; // The line number of the document we're currently on.
+ rootElement = doc.getDefaultRootElement(); // To shorten accesses in our loop.
+ numDocLines = rootElement.getElementCount(); // The number of lines in our document.
+ while (currentDocLineNumber -1) {
+ int spacesNeeded = tabSizeInSpaces - (tabIndex % tabSizeInSpaces);
+ String replacementString = "";
+ for (int i=0; i MAX_CHARS_PER_LINE) {
+
+ numPrintedLines++;
+ if (numPrintedLines > STARTING_LINE_NUMBER) {
+ g.drawString(curLineString.substring(0,MAX_CHARS_PER_LINE), xOffset,y);
+ y += fontHeight;
+ if (numPrintedLines==STARTING_LINE_NUMBER+MAX_LINES_PER_PAGE)
+ return Printable.PAGE_EXISTS;
+ }
+
+ curLineString = curLineString.substring(MAX_CHARS_PER_LINE, curLineString.length());
+
+ }
+
+ currentDocLineNumber += 1; // We have printed one more line from the document.
+
+ numPrintedLines++;
+ if (numPrintedLines>STARTING_LINE_NUMBER) {
+ g.drawString(curLineString, xOffset,y);
+ y += fontHeight;
+ if (numPrintedLines==STARTING_LINE_NUMBER+MAX_LINES_PER_PAGE)
+ return Printable.PAGE_EXISTS;
+ }
+
+
+ }
+
+ // Now, the whole document has been "printed." Decide if this page had any text on it or not.
+ if (numPrintedLines > STARTING_LINE_NUMBER)
+ return Printable.PAGE_EXISTS;
+ return Printable.NO_SUCH_PAGE;
+
+ }
+
+
+ /**
+ * Prints a Document
using a monospaced font, word wrapping on
+ * the characters ' ', '\t', '\n', ',', '.', and ';'. This method is
+ * expected to be called from Printable 'print(Graphics g)' functions.
+ *
+ * @param g The graphics context to write to.
+ * @param doc The javax.swing.text.Document
to print.
+ * @param fontSize the point size to use for the monospaced font.
+ * @param pageIndex The page number to print.
+ * @param pageFormat The format to print the page with.
+ * @param tabSize The number of spaces to expand tabs to.
+ *
+ * @see #printDocumentMonospaced
+ */
+ public static int printDocumentMonospacedWordWrap(Graphics g, Document doc,
+ int fontSize, int pageIndex,
+ PageFormat pageFormat, int tabSize) {
+
+ g.setColor(Color.BLACK);
+ g.setFont(new Font("Monospaced", Font.PLAIN, fontSize));
+
+ // Initialize our static variables (these are used by our tab expander below).
+ tabSizeInSpaces = tabSize;
+ fm = g.getFontMetrics();
+
+ // Create our tab expander.
+ //RPrintTabExpander tabExpander = new RPrintTabExpander();
+
+ // Get width and height of characters in this monospaced font.
+ int fontWidth = fm.charWidth('w'); // Any character will do here, since font is monospaced.
+ int fontHeight = fm.getHeight();
+
+ int MAX_CHARS_PER_LINE = (int)pageFormat.getImageableWidth() / fontWidth;
+ int MAX_LINES_PER_PAGE = (int)pageFormat.getImageableHeight() / fontHeight;
+
+ final int STARTING_LINE_NUMBER = MAX_LINES_PER_PAGE * pageIndex;
+
+ // The (x,y) coordinate to print at (in pixels, not characters).
+ // Since y is the baseline of where we'll start printing (not the top-left
+ // corner), we offset it by the font's ascent ( + 1 just for good measure).
+ xOffset = (int)pageFormat.getImageableX();
+ int y = (int)pageFormat.getImageableY() + fm.getAscent() + 1;
+
+ // A counter to keep track of the number of lines that WOULD HAVE been
+ // printed if we were printing all lines.
+ int numPrintedLines = 0;
+
+ // Keep going while there are more lines in the document.
+ currentDocLineNumber = 0; // The line number of the document we're currently on.
+ rootElement = doc.getDefaultRootElement(); // To shorten accesses in our loop.
+ numDocLines = rootElement.getElementCount(); // The number of lines in our document.
+ while (currentDocLineNumber -1) {
+ int spacesNeeded = tabSizeInSpaces - (tabIndex % tabSizeInSpaces);
+ String replacementString = "";
+ for (int i=0; i MAX_CHARS_PER_LINE) {
+
+ int breakPoint = getLineBreakPoint(curLineString, MAX_CHARS_PER_LINE) + 1;
+
+ numPrintedLines++;
+ if (numPrintedLines > STARTING_LINE_NUMBER) {
+ g.drawString(curLineString.substring(0,breakPoint), xOffset,y);
+ y += fontHeight;
+ if (numPrintedLines==STARTING_LINE_NUMBER+MAX_LINES_PER_PAGE)
+ return Printable.PAGE_EXISTS;
+ }
+
+ curLineString = curLineString.substring(breakPoint, curLineString.length());
+
+ }
+
+ currentDocLineNumber += 1; // We have printed one more line from the document.
+
+ numPrintedLines++;
+ if (numPrintedLines>STARTING_LINE_NUMBER) {
+ g.drawString(curLineString, xOffset,y);
+ y += fontHeight;
+ if (numPrintedLines==STARTING_LINE_NUMBER+MAX_LINES_PER_PAGE)
+ return Printable.PAGE_EXISTS;
+ }
+
+
+ }
+
+ // Now, the whole document has been "printed." Decide if this page had any text on it or not.
+ if (numPrintedLines > STARTING_LINE_NUMBER)
+ return Printable.PAGE_EXISTS;
+ return Printable.NO_SUCH_PAGE;
+
+ }
+
+
+ /**
+ * Prints a Document
using the specified font, word wrapping
+ * on the characters ' ', '\t', '\n', ',', '.', and ';'. This method is
+ * expected to be called from Printable 'print(Graphics g)' functions.
+ *
+ * @param g The graphics context to write to.
+ * @param textComponent The javax.swing.text.JTextComponent
+ * whose text you're printing.
+ * @param font The font to use for printing. If null
, then
+ * textComponent
's font is used.
+ * @param pageIndex The page number to print.
+ * @param pageFormat The format to print the page with.
+ * @param tabSize The number of spaces to convert tabs to.
+ *
+ */
+ public static int printDocumentWordWrap(Graphics g, JTextComponent textComponent,
+ Font font, int pageIndex,
+ PageFormat pageFormat,
+ int tabSize) {
+
+ // Initialize our graphics object.
+ g.setColor(Color.BLACK);
+ g.setFont(font!=null ? font : textComponent.getFont());
+
+ // Initialize our static variables (these are used by our tab expander below).
+ tabSizeInSpaces = tabSize;
+ fm = g.getFontMetrics();
+ int fontHeight = fm.getHeight();
+
+ final int LINE_LENGTH_IN_PIXELS = (int)pageFormat.getImageableWidth();
+ final int MAX_LINES_PER_PAGE = (int)pageFormat.getImageableHeight() / fontHeight;
+
+ final int STARTING_LINE_NUMBER = MAX_LINES_PER_PAGE * pageIndex;
+
+ // Create our tab expander.
+ RPrintTabExpander tabExpander = new RPrintTabExpander();
+
+ // The (x,y) coordinate to print at (in pixels, not characters).
+ // Since y is the baseline of where we'll start printing (not the top-left
+ // corner), we offset it by the font's ascent ( + 1 just for good measure).
+ xOffset = (int)pageFormat.getImageableX();
+ int y = (int)pageFormat.getImageableY() + fm.getAscent() + 1;
+
+ // A counter to keep track of the number of lines that WOULD HAVE been
+ // printed if we were printing all lines.
+ int numPrintedLines = 0;
+
+ // Keep going while there are more lines in the document.
+ Document doc = textComponent.getDocument();
+ rootElement = doc.getDefaultRootElement();
+ numDocLines = rootElement.getElementCount(); // The number of lines in our document.
+ currentDocLineNumber = 0; // The line number of the document we're currently on.
+ int startingOffset = 0; // Used when a line is so long it has to be wrapped.
+ while (currentDocLineNumber LINE_LENGTH_IN_PIXELS) {
+
+//System.err.println("'" + currentLineSeg + "' - " + currentLineLengthInPixels + "/" + LINE_LENGTH_IN_PIXELS);
+
+ // Remove any spaces and/or tabs from the end of the segment (would cause problems if you left 'em).
+ currentLineSeg = removeEndingWhitespace(currentLineSeg);
+
+ // currentPos will be the last position in the current text of a "line break character."
+ currentPos = -1;
+ String currentLineString = currentLineSeg.toString();
+ for (int i=0; i-1 && pos>currentPos)
+ // currentPos = pos;
+ if (pos>0 && pos>currentPos & pos!=currentLineString.length())
+ currentPos = pos;
+ }
+
+ // If we didn't find a line break character, we'll simply break the line at
+ // the last character that fits on a printed line.
+ // So here, we set currentPos to be the position of the last character that fits
+ // on the current printed line.
+ if (currentPos == -1) {
+
+ // Fix currentLineSeg so that it contains exactly enough text to fit in
+ // LINE_LENGTH_IN_PIXELS pixels...
+ currentPos = 0;
+ do {
+ currentPos++;
+ try {
+ doc.getText(currentLineStart+startingOffset, currentPos, currentLineSeg);
+ } catch (BadLocationException ble) {
+ System.err.println(ble);
+ return Printable.NO_SUCH_PAGE;
+ }
+ currentLineLengthInPixels = Utilities.
+ getTabbedTextWidth(currentLineSeg, fm, 0, tabExpander, 0);
+ } while (currentLineLengthInPixels <= LINE_LENGTH_IN_PIXELS);
+ currentPos--;
+
+ }
+
+ try {
+ doc.getText((currentLineStart+startingOffset), currentPos, currentLineSeg);
+ } catch (BadLocationException ble) {
+ System.err.println("BadLocationException in print (a):");
+ System.err.println("==> currentLineStart: " + currentLineStart +
+ "; startingOffset: " + startingOffset + "; currentPos: " + currentPos);
+ System.err.println("==> Range: " + (currentLineStart+startingOffset) + " - " +
+ (currentLineStart+startingOffset+currentPos));
+ ble.printStackTrace();
+ return Printable.NO_SUCH_PAGE;
+ }
+
+ currentLineLengthInPixels = Utilities.getTabbedTextWidth(currentLineSeg, fm, 0, tabExpander, 0);
+ } // End of while (currentLineLengthInPixels > LINE_LENGTH_IN_PIXELS).
+
+ startingOffset += currentPos; // Where to start (offset from line's start), since this line wraps.
+
+ } // End of else.
+
+ numPrintedLines++;
+ if (numPrintedLines>STARTING_LINE_NUMBER) {
+ //g.drawString(currentLineSeg.toString(), xOffset,y);
+ Utilities.drawTabbedText(currentLineSeg, xOffset,y, g, tabExpander, 0);
+ y += fontHeight;
+ if (numPrintedLines==STARTING_LINE_NUMBER+MAX_LINES_PER_PAGE)
+ return Printable.PAGE_EXISTS;
+ }
+
+ }
+
+ // Now, the whole document has been "printed." Decide if this page had any text on it or not.
+ if (numPrintedLines > STARTING_LINE_NUMBER)
+ return Printable.PAGE_EXISTS;
+ return Printable.NO_SUCH_PAGE;
+
+ }
+
+
+ /**
+ * Removes any spaces or tabs from the end of the segment.
+ *
+ * @param segment The segment from which to remove tailing whitespace.
+ * @return segment
with trailing whitespace removed.
+ */
+ private static Segment removeEndingWhitespace(Segment segment) {
+ int toTrim = 0;
+ char currentChar = segment.setIndex(segment.getEndIndex()-1);
+ while ((currentChar==' ' || currentChar=='\t') && currentChar!=Segment.DONE) {
+ toTrim++;
+ currentChar = segment.previous();
+ }
+ String stringVal = segment.toString();
+ String newStringVal = stringVal.substring(0,stringVal.length()-toTrim);
+ return new Segment(newStringVal.toCharArray(), 0, newStringVal.length());
+ }
+
+
+ /**
+ * A tab expander for the document currently being printed with the
+ * font being used for the printing.
+ */
+ private static class RPrintTabExpander implements TabExpander {
+
+ RPrintTabExpander() {
+ }
+
+ public float nextTabStop(float x, int tabOffset) {
+ if (tabSizeInSpaces == 0)
+ return x;
+ int tabSizeInPixels = tabSizeInSpaces * fm.charWidth(' ');
+ int ntabs = (((int) x) - xOffset) / tabSizeInPixels;
+ return xOffset + ((ntabs + 1) * tabSizeInPixels);
+ }
+
+ }
+
+
+}
Index: /other-projects/gli-rsyntax-textarea/src/java/org/fife/print/package.html
===================================================================
--- /other-projects/gli-rsyntax-textarea/src/java/org/fife/print/package.html (revision 25585)
+++ /other-projects/gli-rsyntax-textarea/src/java/org/fife/print/package.html (revision 25585)
@@ -0,0 +1,5 @@
+
+
+ Utility methods for printing text in a JTextComponent
.
+
+
Index: /other-projects/gli-rsyntax-textarea/src/java/org/fife/ui/rsyntaxtextarea/AbstractJFlexCTokenMaker.java
===================================================================
--- /other-projects/gli-rsyntax-textarea/src/java/org/fife/ui/rsyntaxtextarea/AbstractJFlexCTokenMaker.java (revision 25585)
+++ /other-projects/gli-rsyntax-textarea/src/java/org/fife/ui/rsyntaxtextarea/AbstractJFlexCTokenMaker.java (revision 25585)
@@ -0,0 +1,219 @@
+/*
+ * 01/25/2009
+ *
+ * AbstractJFlexCTokenMaker.java - Base class for token makers that use curly
+ * braces to denote code blocks, such as C, C++, Java, Perl, etc.
+ *
+ * This library is distributed under a modified BSD license. See the included
+ * RSyntaxTextArea.License.txt file for details.
+ */
+package org.fife.ui.rsyntaxtextarea;
+
+import java.awt.event.ActionEvent;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+import javax.swing.Action;
+import javax.swing.UIManager;
+import javax.swing.text.BadLocationException;
+
+import org.fife.ui.rtextarea.RTextArea;
+
+
+
+/**
+ * Base class for JFlex-based token makers using C-style syntax. This class
+ * knows how to auto-indent after opening braces and parens.
+ *
+ * @author Robert Futrell
+ * @version 1.0
+ */
+public abstract class AbstractJFlexCTokenMaker extends AbstractJFlexTokenMaker {
+
+ protected static final Action INSERT_BREAK_ACTION = new InsertBreakAction();
+
+
+ /**
+ * Returns true
always as C-style languages use curly braces
+ * to denote code blocks.
+ *
+ * @return true
always.
+ */
+ public boolean getCurlyBracesDenoteCodeBlocks() {
+ return true;
+ }
+
+
+ /**
+ * Returns an action to handle "insert break" key presses (i.e. Enter).
+ * An action is returned that handles newlines differently in multi-line
+ * comments.
+ *
+ * @return The action.
+ */
+ public Action getInsertBreakAction() {
+ return INSERT_BREAK_ACTION;
+ }
+
+
+ /**
+ * {@inheritDoc}
+ */
+ public boolean getMarkOccurrencesOfTokenType(int type) {
+ return type==Token.IDENTIFIER || type==Token.FUNCTION;
+ }
+
+
+ /**
+ * {@inheritDoc}
+ */
+ public boolean getShouldIndentNextLineAfter(Token t) {
+ if (t!=null && t.textCount==1) {
+ char ch = t.text[t.textOffset];
+ return ch=='{' || ch=='(';
+ }
+ return false;
+ }
+
+
+ /**
+ * Action that knows how to special-case inserting a newline in a
+ * multi-line comment for languages like C and Java.
+ */
+ private static class InsertBreakAction extends
+ RSyntaxTextAreaEditorKit.InsertBreakAction {
+
+ private static final Pattern p =
+ Pattern.compile("([ \\t]*)(/?[\\*]+)([ \\t]*)");
+
+ public void actionPerformedImpl(ActionEvent e, RTextArea textArea) {
+
+ if (!textArea.isEditable() || !textArea.isEnabled()) {
+ UIManager.getLookAndFeel().provideErrorFeedback(textArea);
+ return;
+ }
+
+ RSyntaxTextArea rsta = (RSyntaxTextArea)getTextComponent(e);
+ RSyntaxDocument doc = (RSyntaxDocument)rsta.getDocument();
+
+ int line = textArea.getCaretLineNumber();
+ int type = doc.getLastTokenTypeOnLine(line);
+
+ // Only in MLC's should we try this
+ if (type==Token.COMMENT_DOCUMENTATION ||
+ type==Token.COMMENT_MULTILINE) {
+ insertBreakInMLC(e, rsta, line);
+ }
+ else {
+ handleInsertBreak(rsta, true);
+ }
+
+ }
+
+
+ /**
+ * Returns whether the MLC token containing offs
appears
+ * to have a "nested" comment (i.e., contains "/*
"
+ * somewhere inside of it). This implies that it is likely a "new" MLC
+ * and needs to be closed. While not foolproof, this is usually good
+ * enough of a sign.
+ *
+ * @param textArea
+ * @param line
+ * @param offs
+ * @return Whether a comment appears to be nested inside this one.
+ */
+ private boolean appearsNested(RSyntaxTextArea textArea,
+ int line, int offs) {
+
+ final int firstLine = line; // Remember the line we start at.
+
+ while (line=start &&
+ dotalmost could
+ * be factored out into this class, but cannot because they reference JFlex
+ * variables that we cannot access from this class.
+ *
+ * @author Robert Futrell
+ * @version 0.1
+ */
+public abstract class AbstractJFlexTokenMaker extends TokenMakerBase {
+
+ protected Segment s;
+
+ protected int start; // Just for states.
+ protected int offsetShift; // As parser always starts at 0, but our line doesn't.
+
+
+}
Index: /other-projects/gli-rsyntax-textarea/src/java/org/fife/ui/rsyntaxtextarea/AbstractTokenMaker.java
===================================================================
--- /other-projects/gli-rsyntax-textarea/src/java/org/fife/ui/rsyntaxtextarea/AbstractTokenMaker.java (revision 25585)
+++ /other-projects/gli-rsyntax-textarea/src/java/org/fife/ui/rsyntaxtextarea/AbstractTokenMaker.java (revision 25585)
@@ -0,0 +1,67 @@
+/*
+ * 11/07/2004
+ *
+ * AbstractTokenMaker.java - An abstract implementation of TokenMaker.
+ *
+ * This library is distributed under a modified BSD license. See the included
+ * RSyntaxTextArea.License.txt file for details.
+ */
+package org.fife.ui.rsyntaxtextarea;
+
+
+/**
+ * An abstract implementation of the
+ * {@link org.fife.ui.rsyntaxtextarea.TokenMaker} interface. It should
+ * be overridden for every language for which you want to provide
+ * syntax highlighting.
+ *
+ * @see Token
+ *
+ * @author Robert Futrell
+ * @version 0.2
+ */
+public abstract class AbstractTokenMaker extends TokenMakerBase {
+
+ /**
+ * Hash table of words to highlight and what token type they are.
+ * The keys are the words to highlight, and their values are the
+ * token types, for example, Token.RESERVED_WORD
or
+ * Token.FUNCTION
.
+ */
+ protected TokenMap wordsToHighlight;
+
+
+ /**
+ * Constructor.
+ */
+ public AbstractTokenMaker() {
+ wordsToHighlight = getWordsToHighlight();
+ }
+
+
+ /**
+ * Returns the words to highlight for this programming language.
+ *
+ * @return A TokenMap
containing the words to highlight for
+ * this programming language.
+ */
+ public abstract TokenMap getWordsToHighlight();
+
+
+ /**
+ * Removes the token last added from the linked list of tokens. The
+ * programmer should never have to call this directly; it can be called
+ * by subclasses of TokenMaker
if necessary.
+ */
+ public void removeLastToken() {
+ if (previousToken==null) {
+ firstToken = currentToken = null;
+ }
+ else {
+ currentToken = previousToken;
+ currentToken.setNextToken(null);
+ }
+ }
+
+
+}
Index: /other-projects/gli-rsyntax-textarea/src/java/org/fife/ui/rsyntaxtextarea/AbstractTokenMakerFactory.java
===================================================================
--- /other-projects/gli-rsyntax-textarea/src/java/org/fife/ui/rsyntaxtextarea/AbstractTokenMakerFactory.java (revision 25585)
+++ /other-projects/gli-rsyntax-textarea/src/java/org/fife/ui/rsyntaxtextarea/AbstractTokenMakerFactory.java (revision 25585)
@@ -0,0 +1,98 @@
+/*
+ * 12/14/08
+ *
+ * AbstractTokenMakerFactory.java - Base class for TokenMaker implementations.
+ *
+ * This library is distributed under a modified BSD license. See the included
+ * RSyntaxTextArea.License.txt file for details.
+ */
+package org.fife.ui.rsyntaxtextarea;
+
+import java.util.Map;
+import java.util.Set;
+
+
+/**
+ * Base class for {@link TokenMakerFactory} implementations. A
+ * java.util.Map
maps keys to the names of {@link TokenMaker}
+ * classes.
+ *
+ * @author Robert Futrell
+ * @version 1.0
+ */
+public abstract class AbstractTokenMakerFactory extends TokenMakerFactory {
+
+ /**
+ * A mapping from keys to the names of {@link TokenMaker} implementation
+ * class names. When {@link #getTokenMaker(String)} is called with a key
+ * defined in this map, a TokenMaker
of the corresponding type
+ * is returned.
+ */
+ private Map tokenMakerMap;
+
+
+ /**
+ * Constructor.
+ */
+ protected AbstractTokenMakerFactory() {
+ tokenMakerMap = createTokenMakerKeyToClassNameMap();
+ }
+
+
+
+ /**
+ * Creates and returns a mapping from keys to the names of
+ * {@link TokenMaker} implementation classes. When
+ * {@link #getTokenMaker(String)} is called with a key defined in this
+ * map, a TokenMaker
of the corresponding type is returned.
+ *
+ * @return The map.
+ */
+ protected abstract Map createTokenMakerKeyToClassNameMap();
+
+
+ /**
+ * Returns a {@link TokenMaker} for the specified key.
+ *
+ * @param key The key.
+ * @return The corresponding TokenMaker
, or null
+ * if none matches the specified key.
+ */
+ protected TokenMaker getTokenMakerImpl(String key) {
+ String clazz = (String)tokenMakerMap.get(key);
+ if (clazz!=null) {
+ try {
+ return (TokenMaker)Class.forName(clazz).newInstance();
+ } catch (RuntimeException re) { // FindBugs
+ throw re;
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+ return null;
+ }
+
+
+ /**
+ * {@inheritDoc}
+ */
+ public Set keySet() {
+ return tokenMakerMap.keySet();
+ }
+
+
+ /**
+ * Adds a mapping from a key to a TokenMaker
implementation
+ * class name.
+ *
+ * @param key The key.
+ * @param className The TokenMaker
class name.
+ * @return The previous value for the specified key, or null
+ * if there was none.
+ */
+ public String putMapping(String key, String className) {
+ return (String)tokenMakerMap.put(key, className);
+ }
+
+
+}
Index: /other-projects/gli-rsyntax-textarea/src/java/org/fife/ui/rsyntaxtextarea/ActiveLineRangeEvent.java
===================================================================
--- /other-projects/gli-rsyntax-textarea/src/java/org/fife/ui/rsyntaxtextarea/ActiveLineRangeEvent.java (revision 25585)
+++ /other-projects/gli-rsyntax-textarea/src/java/org/fife/ui/rsyntaxtextarea/ActiveLineRangeEvent.java (revision 25585)
@@ -0,0 +1,68 @@
+/*
+ * 02/06/2011
+ *
+ * ActiveLineRangeEvent.java - Notifies listeners of an "active line range"
+ * change in an RSyntaxTextArea.
+ *
+ * This library is distributed under a modified BSD license. See the included
+ * RSyntaxTextArea.License.txt file for details.
+ */
+package org.fife.ui.rsyntaxtextarea;
+
+import java.util.EventObject;
+
+
+/**
+ * The event fired by {@link RSyntaxTextArea}s when the active line range
+ * changes.
+ *
+ * @author Robert Futrell
+ * @version 1.0
+ */
+public class ActiveLineRangeEvent extends EventObject {
+
+ private int min;
+ private int max;
+
+
+ /**
+ * Constructor.
+ *
+ * @param source The text area.
+ * @param min The first line in the active line range, or
+ * -1
if the line range is being cleared.
+ * @param max The last line in the active line range, or
+ * -1
if the line range is being cleared.
+ */
+ public ActiveLineRangeEvent(RSyntaxTextArea source, int min, int max) {
+ super(source);
+ this.min = min;
+ this.max = max;
+ }
+
+
+ /**
+ * Returns the last line in the active line range.
+ *
+ * @return The last line, or -1
if the range is being
+ * cleared.
+ * @see #getMin()
+ */
+ public int getMax() {
+ return max;
+ }
+
+
+ /**
+ * Returns the first line in the active line range.
+ *
+ * @return The first line, or -1
if the range is being
+ * cleared.
+ * @see #getMax()
+ */
+ public int getMin() {
+ return min;
+ }
+
+
+}
Index: /other-projects/gli-rsyntax-textarea/src/java/org/fife/ui/rsyntaxtextarea/ActiveLineRangeListener.java
===================================================================
--- /other-projects/gli-rsyntax-textarea/src/java/org/fife/ui/rsyntaxtextarea/ActiveLineRangeListener.java (revision 25585)
+++ /other-projects/gli-rsyntax-textarea/src/java/org/fife/ui/rsyntaxtextarea/ActiveLineRangeListener.java (revision 25585)
@@ -0,0 +1,44 @@
+/*
+ * 02/06/2011
+ *
+ * ActiveLineRangeListener.java - Listens for "active line range" changes
+ * in an RSyntaxTextArea.
+ *
+ * This library is distributed under a modified BSD license. See the included
+ * RSyntaxTextArea.License.txt file for details.
+ */
+package org.fife.ui.rsyntaxtextarea;
+
+import java.util.EventListener;
+
+
+/**
+ * Listens for "active line range" events from an RSyntaxTextArea
.
+ * If a text area contains some semantic knowledge of the programming language
+ * being edited, it may broadcast {@link ActiveLineRangeEvent}s whenever the
+ * caret moves into a new "block" of code. Listeners can listen for these
+ * events and respond accordingly.
+ *
+ * See the RSTALanguageSupport
project at
+ * http://fifesoft.com for some
+ * LanguageSupport
implementations that may broadcast these
+ * events. Note that if an RSTA/LanguageSupport does not support broadcasting
+ * these events, the listener will simply never receive any notifications.
+ *
+ * @author Robert Futrell
+ * @version 1.0
+ */
+public interface ActiveLineRangeListener extends EventListener {
+
+
+ /**
+ * Called whenever the "active line range" changes.
+ *
+ * @param e Information about the line range change. If there is no longer
+ * an "active line range," the "minimum" and "maximum" line values
+ * should both be -1
.
+ */
+ public void activeLineRangeChanged(ActiveLineRangeEvent e);
+
+
+}
Index: /other-projects/gli-rsyntax-textarea/src/java/org/fife/ui/rsyntaxtextarea/ChangeableColorHighlightPainter.java
===================================================================
--- /other-projects/gli-rsyntax-textarea/src/java/org/fife/ui/rsyntaxtextarea/ChangeableColorHighlightPainter.java (revision 25585)
+++ /other-projects/gli-rsyntax-textarea/src/java/org/fife/ui/rsyntaxtextarea/ChangeableColorHighlightPainter.java (revision 25585)
@@ -0,0 +1,67 @@
+/*
+ * 07/23/2009
+ *
+ * ChangeableColorHighlightPainter.java - A highlighter whose color you can
+ * change.
+ *
+ * This library is distributed under a modified BSD license. See the included
+ * RSyntaxTextArea.License.txt file for details.
+ */
+package org.fife.ui.rsyntaxtextarea;
+
+import java.awt.Color;
+import javax.swing.text.DefaultHighlighter.DefaultHighlightPainter;
+
+
+/**
+ * A highlighter whose color you can change.
+ *
+ * @author Robert Futrell
+ * @version 1.0
+ */
+class ChangeableColorHighlightPainter extends DefaultHighlightPainter {
+
+ /**
+ * DefaultHighlightPainter doesn't allow changing color, so we must cache
+ * ours here.
+ */
+ private Color color;
+
+
+ /**
+ * Constructor.
+ *
+ * @param color The initial color to use. This cannot be null
.
+ */
+ public ChangeableColorHighlightPainter(Color color) {
+ super(color);
+ setColor(color);
+ }
+
+
+ /**
+ * Returns the color to paint with.
+ *
+ * @return The color.
+ * @see #setColor(Color)
+ */
+ public Color getColor() {
+ return color;
+ }
+
+
+ /**
+ * Sets the color to paint the bounding boxes with.
+ *
+ * @param color The new color. This cannot be null
.
+ * @see #getColor()
+ */
+ public void setColor(Color color) {
+ if (color==null) {
+ throw new IllegalArgumentException("color cannot be null");
+ }
+ this.color = color;
+ }
+
+
+}
Index: /other-projects/gli-rsyntax-textarea/src/java/org/fife/ui/rsyntaxtextarea/CodeTemplateManager.java
===================================================================
--- /other-projects/gli-rsyntax-textarea/src/java/org/fife/ui/rsyntaxtextarea/CodeTemplateManager.java (revision 25585)
+++ /other-projects/gli-rsyntax-textarea/src/java/org/fife/ui/rsyntaxtextarea/CodeTemplateManager.java (revision 25585)
@@ -0,0 +1,470 @@
+/*
+ * 02/21/2005
+ *
+ * CodeTemplateManager.java - manages code templates.
+ *
+ * This library is distributed under a modified BSD license. See the included
+ * RSyntaxTextArea.License.txt file for details.
+ */
+package org.fife.ui.rsyntaxtextarea;
+
+import java.awt.event.InputEvent;
+import java.awt.event.KeyEvent;
+import java.beans.XMLDecoder;
+import java.beans.XMLEncoder;
+import java.io.BufferedInputStream;
+import java.io.BufferedOutputStream;
+import java.io.File;
+import java.io.FileFilter;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.Serializable;
+import java.util.*;
+import javax.swing.KeyStroke;
+import javax.swing.text.BadLocationException;
+import javax.swing.text.Document;
+import javax.swing.text.Segment;
+
+import org.fife.ui.rsyntaxtextarea.templates.CodeTemplate;
+
+
+/**
+ * Manages "code templates."
+ *
+ * All methods in this class are synchronized for thread safety, but as a
+ * best practice, you should probably only modify the templates known to a
+ * CodeTemplateManager
on the EDT. Modifying a
+ * CodeTemplate
retrieved from a CodeTemplateManager
+ * while not on the EDT could cause problems.
+ *
+ * @author Robert Futrell
+ * @version 0.1
+ */
+public class CodeTemplateManager {
+
+ private int maxTemplateIDLength;
+ private List templates;
+
+ private KeyStroke insertTrigger;
+ private String insertTriggerString;
+ private Segment s;
+ private TemplateComparator comparator;
+ private File directory;
+
+ private static final int mask = InputEvent.CTRL_MASK|InputEvent.SHIFT_MASK;
+ static final KeyStroke TEMPLATE_KEYSTROKE = KeyStroke.
+ getKeyStroke(KeyEvent.VK_SPACE, mask);
+
+
+ /**
+ * Constructor.
+ */
+ public CodeTemplateManager() {
+
+ // Default insert trigger is a space.
+ // FIXME: See notes in RSyntaxTextAreaDefaultInputMap.
+ setInsertTrigger(TEMPLATE_KEYSTROKE);
+
+ s = new Segment();
+ comparator = new TemplateComparator();
+ templates = new ArrayList();
+
+ }
+
+
+ /**
+ * Registers the specified template with this template manager.
+ *
+ * @param template The template to register.
+ * @throws IllegalArgumentException If template
is
+ * null
.
+ * @see #removeTemplate(CodeTemplate)
+ * @see #removeTemplate(String)
+ */
+ public synchronized void addTemplate(CodeTemplate template) {
+ if (template==null) {
+ throw new IllegalArgumentException("template cannot be null");
+ }
+ templates.add(template);
+ sortTemplates();
+ }
+
+
+ /**
+ * Returns the keystroke that is the "insert trigger" for templates;
+ * that is, the character that, when inserted into an instance of
+ * RSyntaxTextArea
, triggers the search for
+ * a template matching the token ending at the caret position.
+ *
+ * @return The insert trigger.
+ * @see #getInsertTriggerString()
+ * @see #setInsertTrigger(KeyStroke)
+ */
+ /*
+ * FIXME: This text IS what's inserted if the trigger character is pressed
+ * in a text area but no template matches, but it is NOT the trigger
+ * character used in the text areas. This is because space (" ") is
+ * hard-coded into RSyntaxTextAreaDefaultInputMap.java. We need to make
+ * this dynamic somehow. See RSyntaxTextAreaDefaultInputMap.java.
+ */
+ public KeyStroke getInsertTrigger() {
+ return insertTrigger;
+ }
+
+
+ /**
+ * Returns the "insert trigger" for templates; that is, the character
+ * that, when inserted into an instance of RSyntaxTextArea
,
+ * triggers the search for a template matching the token ending at the
+ * caret position.
+ *
+ * @return The insert trigger character.
+ * @see #getInsertTrigger()
+ * @see #setInsertTrigger(KeyStroke)
+ */
+ /*
+ * FIXME: This text IS what's inserted if the trigger character is pressed
+ * in a text area but no template matches, but it is NOT the trigger
+ * character used in the text areas. This is because space (" ") is
+ * hard-coded into RSyntaxTextAreaDefaultInputMap.java. We need to make
+ * this dynamic somehow. See RSyntaxTextAreaDefaultInputMap.java.
+ */
+ public String getInsertTriggerString() {
+ return insertTriggerString;
+ }
+
+
+ /**
+ * Returns the template that should be inserted at the current caret
+ * position, assuming the trigger character was pressed.
+ *
+ * @param textArea The text area that's getting text inserted into it.
+ * @return A template that should be inserted, if appropriate, or
+ * null
if no template should be inserted.
+ */
+ public synchronized CodeTemplate getTemplate(RSyntaxTextArea textArea) {
+ int caretPos = textArea.getCaretPosition();
+ int charsToGet = Math.min(caretPos, maxTemplateIDLength);
+ try {
+ Document doc = textArea.getDocument();
+ doc.getText(caretPos-charsToGet, charsToGet, s);
+ int index = Collections.binarySearch(templates, s, comparator);
+ return index>=0 ? (CodeTemplate)templates.get(index) : null;
+ } catch (BadLocationException ble) {
+ ble.printStackTrace();
+ throw new InternalError("Error in CodeTemplateManager");
+ }
+ }
+
+
+ /**
+ * Returns the number of templates this manager knows about.
+ *
+ * @return The template count.
+ */
+ public synchronized int getTemplateCount() {
+ return templates.size();
+ }
+
+
+ /**
+ * Returns the templates currently available.
+ *
+ * @return The templates available.
+ */
+ public synchronized CodeTemplate[] getTemplates() {
+ CodeTemplate[] temp = new CodeTemplate[templates.size()];
+ return (CodeTemplate[])templates.toArray(temp);
+ }
+
+
+ /**
+ * Returns whether the specified character is a valid character for a
+ * CodeTemplate
id.
+ *
+ * @param ch The character to check.
+ * @return Whether the character is a valid template character.
+ */
+ public static final boolean isValidChar(char ch) {
+ return RSyntaxUtilities.isLetterOrDigit(ch) || ch=='_';
+ }
+
+
+ /**
+ * Returns the specified code template.
+ *
+ * @param template The template to remove.
+ * @return true
if the template was removed, false
+ * if the template was not in this template manager.
+ * @throws IllegalArgumentException If template
is
+ * null
.
+ * @see #removeTemplate(String)
+ * @see #addTemplate(CodeTemplate)
+ */
+ public synchronized boolean removeTemplate(CodeTemplate template) {
+
+ if (template==null) {
+ throw new IllegalArgumentException("template cannot be null");
+ }
+
+ // TODO: Do a binary search
+ return templates.remove(template);
+
+ }
+
+
+ /**
+ * Returns the code template with the specified id.
+ *
+ * @param id The id to check for.
+ * @return The code template that was removed, or null
if
+ * there was no template with the specified ID.
+ * @throws IllegalArgumentException If id
is null
.
+ * @see #removeTemplate(CodeTemplate)
+ * @see #addTemplate(CodeTemplate)
+ */
+ public synchronized CodeTemplate removeTemplate(String id) {
+
+ if (id==null) {
+ throw new IllegalArgumentException("id cannot be null");
+ }
+
+ // TODO: Do a binary search
+ for (Iterator i=templates.iterator(); i.hasNext(); ) {
+ CodeTemplate template = (CodeTemplate)i.next();
+ if (id.equals(template.getID())) {
+ i.remove();
+ return template;
+ }
+ }
+
+ return null;
+
+ }
+
+
+ /**
+ * Replaces the current set of available templates with the ones
+ * specified.
+ *
+ * @param newTemplates The new set of templates. Note that we will
+ * be taking a shallow copy of these and sorting them.
+ */
+ public synchronized void replaceTemplates(CodeTemplate[] newTemplates) {
+ templates.clear();
+ if (newTemplates!=null) {
+ for (int i=0; iRSyntaxTextArea, the last-typed token is found,
+ * and is checked against all template ID's to see if a template
+ * should be inserted. If a template ID matches, that template is
+ * inserted; if not, the trigger character is inserted. If this
+ * parameter is null
, no change is made to the trigger
+ * character.
+ * @see #getInsertTrigger()
+ * @see #getInsertTriggerString()
+ */
+ /*
+ * FIXME: The trigger set here IS inserted when no matching template
+ * is found, but a space character (" ") is always used as the "trigger"
+ * to look for templates. This is because it is hard-coded in
+ * RSyntaxTextArea's input map this way. We need to change this.
+ * See RSyntaxTextAreaDefaultInputMap.java.
+ */
+ public void setInsertTrigger(KeyStroke trigger) {
+ if (trigger!=null) {
+ insertTrigger = trigger;
+ insertTriggerString = Character.toString(trigger.getKeyChar());
+ }
+ }
+
+
+ /**
+ * Sets the directory in which to look for templates. Calling this
+ * method adds any new templates found in the specified directory to
+ * the templates already registered.
+ *
+ * @param dir The new directory in which to look for templates.
+ * @return The new number of templates in this template manager, or
+ * -1
if the specified directory does not exist.
+ */
+ public synchronized int setTemplateDirectory(File dir) {
+
+ if (dir!=null && dir.isDirectory()) {
+
+ this.directory = dir;
+
+ File[] files = dir.listFiles(new XMLFileFilter());
+ int newCount = files==null ? 0 : files.length;
+ int oldCount = templates.size();
+
+ List temp = new ArrayList(oldCount+newCount);
+ temp.addAll(templates);
+
+ for (int i=0; iCodeTemplate as its first
+ * parameter and a Segment
as its second, and knows
+ * to compare the template's ID to the segment's text.
+ */
+ private static class TemplateComparator implements Comparator, Serializable{
+
+ public int compare(Object template, Object segment) {
+
+ // Get template start index (0) and length.
+ CodeTemplate t = (CodeTemplate)template;
+ final char[] templateArray = t.getID().toCharArray();
+ int i = 0;
+ int len1 = templateArray.length;
+
+ // Find "token" part of segment and get its offset and length.
+ Segment s = (Segment)segment;
+ char[] segArray = s.array;
+ int len2 = s.count;
+ int j = s.offset + len2 - 1;
+ while (j>=s.offset && isValidChar(segArray[j])) {
+ j--;
+ }
+ j++;
+ int segShift = j - s.offset;
+ len2 -= segShift;
+
+ int n = Math.min(len1, len2);
+ while (n-- != 0) {
+ char c1 = templateArray[i++];
+ char c2 = segArray[j++];
+ if (c1 != c2)
+ return c1 - c2;
+ }
+ return len1 - len2;
+
+ }
+
+ }
+
+
+ /**
+ * A file filter for File.listFiles() (NOT for JFileChoosers!) that
+ * accepts only XML files.
+ */
+ private static class XMLFileFilter implements FileFilter {
+ public boolean accept(File f) {
+ return f.getName().toLowerCase().endsWith(".xml");
+ }
+ }
+
+
+}
Index: /other-projects/gli-rsyntax-textarea/src/java/org/fife/ui/rsyntaxtextarea/DefaultToken.java
===================================================================
--- /other-projects/gli-rsyntax-textarea/src/java/org/fife/ui/rsyntaxtextarea/DefaultToken.java (revision 25585)
+++ /other-projects/gli-rsyntax-textarea/src/java/org/fife/ui/rsyntaxtextarea/DefaultToken.java (revision 25585)
@@ -0,0 +1,379 @@
+/*
+ * 10/28/2004
+ *
+ * DefaultToken.java - The default token used in syntax highlighting.
+ *
+ * This library is distributed under a modified BSD license. See the included
+ * RSyntaxTextArea.License.txt file for details.
+ */
+package org.fife.ui.rsyntaxtextarea;
+
+import java.awt.Color;
+import java.awt.FontMetrics;
+import java.awt.Graphics2D;
+import java.awt.Rectangle;
+import javax.swing.text.Segment;
+import javax.swing.text.TabExpander;
+import javax.swing.text.Utilities;
+
+
+/**
+ * The default token used in the org.fife.ui.rsyntaxtextarea
syntax
+ * package. This token type paints itself as you would expect, and properly
+ * accounts for rendering hints (anti-aliasing and fractional font metrics).
+ *
+ * The current implementation paints as follows:
+ *
+ * - The first tab, if any, is found in the token.
+ * - All characters up to that tab, if it exists, are painted as a
+ * group. If no tab was found, all characters in the token are
+ * painted.
+ * - If a tab was found, its width is calculated and it is painted.
+ * - Repeat until all characters are painted.
+ *
+ * This method allows for rendering hints to be honored, since all possible
+ * characters are painted in a group. However, adjacent tokens will not have
+ * their "touching" characters rendered with rendering hints.
+ *
+ * A problem with this implementation is that FontMetrics.charsWidth() is still
+ * used to calculate the width of a group of chars painted. Thus, the group of
+ * characters will be painted with the rendering hints specified, but the
+ * following tab (or group of characters if the current group was the end of a
+ * token) will not necessarily be painted at the proper x-coordinate (as
+ * FontMetrics.charsWidth() returns an int
and not a
+ * float
). The way around this would be to calculate the token's
+ * width in such a way that a float is returned (Font.getStringBounds()?).
+ *
+ * @author Robert Futrell
+ * @version 0.5
+ * @see Token
+ * @see VisibleWhitespaceToken
+ */
+public class DefaultToken extends Token {
+
+
+ /**
+ * Creates a "null token." The token itself is not null; rather, it
+ * signifies that it is the last token in a linked list of tokens and
+ * that it is not part of a "multi-line token."
+ */
+ public DefaultToken() {
+ super();
+ }
+
+
+ /**
+ * Constructor.
+ *
+ * @param line The segment from which to get the token.
+ * @param beg The first character's position in line
.
+ * @param end The last character's position in line
.
+ * @param startOffset The offset into the document at which this
+ * token begins.
+ * @param type A token type listed as "generic" above.
+ */
+ public DefaultToken(final Segment line, final int beg, final int end,
+ final int startOffset, final int type) {
+ this(line.array, beg,end, startOffset, type);
+ }
+
+
+ /**
+ * Constructor.
+ *
+ * @param line The segment from which to get the token.
+ * @param beg The first character's position in line
.
+ * @param end The last character's position in line
.
+ * @param startOffset The offset into the document at which this
+ * token begins.
+ * @param type A token type listed as "generic" above.
+ */
+ public DefaultToken(final char[] line, final int beg, final int end,
+ final int startOffset, final int type) {
+ super(line, beg,end, startOffset, type);
+ }
+
+
+ /**
+ * Determines the offset into this token list (i.e., into the
+ * document) that covers pixel location x
if the token list
+ * starts at pixel location x0
.
+ * This method will return the document position "closest" to the
+ * x-coordinate (i.e., if they click on the "right-half" of the
+ * w
in awe
, the caret will be placed in
+ * between the w
and e
; similarly, clicking on
+ * the left-half places the caret between the a
and
+ * w
). This makes it useful for methods such as
+ * viewToModel
found in javax.swing.text.View
+ * subclasses.
+ *
+ * @param textArea The text area from which the token list was derived.
+ * @param e How to expand tabs.
+ * @param x0 The pixel x-location that is the beginning of
+ * tokenList
.
+ * @param x The pixel-position for which you want to get the corresponding
+ * offset.
+ * @return The position (in the document, NOT into the token list!) that
+ * covers the pixel location. If tokenList
is
+ * null
or has type Token.NULL
, then
+ * -1
= x)
+ return offset;
+
+ float currX = x0; // x-coordinate of current char.
+ float nextX = x0; // x-coordinate of next char.
+ float stableX = x0; // Cached ending x-coord. of last tab or token.
+ Token token = this;
+ int last = offset;
+ FontMetrics fm = null;
+
+ while (token!=null && token.isPaintable()) {
+
+ fm = textArea.getFontMetricsForTokenType(token.type);
+ char[] text = token.text;
+ int start = token.textOffset;
+ int end = start + token.textCount;
+
+ for (int i=start; i=currX && x3
+ * here returns the width of the "whi" portion of the token.
+ *
+ * @param numChars The number of characters for which to get the width.
+ * @param textArea The text area in which this token is being painted.
+ * @param e How to expand tabs. This value cannot be null
.
+ * @param x0 The pixel-location at which this token begins. This is needed
+ * because of tabs.
+ * @return The width of the specified number of characters in this token.
+ * @see #getWidth
+ */
+ public float getWidthUpTo(int numChars, RSyntaxTextArea textArea,
+ TabExpander e, float x0) {
+ float width = x0;
+ FontMetrics fm = textArea.getFontMetricsForTokenType(type);
+ if (fm!=null) {
+ int w;
+ int currentStart = textOffset;
+ int endBefore = textOffset + numChars;
+ for (int i=currentStart; i0)
+ width += fm.charsWidth(text, currentStart, w);
+ currentStart = i+1;
+ width = e.nextTabStop(width, 0);
+ }
+ }
+ // Most (non-whitespace) tokens will have characters at this
+ // point to get the widths for, so we don't check for w>0 (mini-
+ // optimization).
+ w = endBefore-currentStart;
+ width += fm.charsWidth(text, currentStart, w);
+ }
+ return width - x0;
+ }
+
+
+ /**
+ * Returns the bounding box for the specified document location. The
+ * location must be in the specified token list.
+ *
+ * @param textArea The text area from which the token list was derived.
+ * @param e How to expand tabs.
+ * @param pos The position in the document for which to get the bounding
+ * box in the view.
+ * @param x0 The pixel x-location that is the beginning of
+ * tokenList
.
+ * @param rect The rectangle in which we'll be returning the results. This
+ * object is reused to keep from frequent memory allocations.
+ * @return The bounding box for the specified position in the model.
+ */
+ public Rectangle listOffsetToView(RSyntaxTextArea textArea, TabExpander e,
+ int pos, int x0, Rectangle rect) {
+
+ int stableX = x0; // Cached ending x-coord. of last tab or token.
+ Token token = this;
+ FontMetrics fm = null;
+ Segment s = new Segment();
+
+ while (token!=null && token.isPaintable()) {
+
+ fm = textArea.getFontMetricsForTokenType(token.type);
+ if (fm==null) {
+ return rect; // Don't return null as things'll error.
+ }
+ char[] text = token.text;
+ int start = token.textOffset;
+ int end = start + token.textCount;
+
+ // If this token contains the position for which to get the
+ // bounding box...
+ if (token.containsPosition(pos)) {
+
+ s.array = token.text;
+ s.offset = token.textOffset;
+ s.count = pos-token.offset;
+
+ // Must use this (actually fm.charWidth()), and not
+ // fm.charsWidth() for returned value to match up with where
+ // text is actually painted on OS X!
+ int w = Utilities.getTabbedTextWidth(s, fm, stableX, e,
+ token.offset);
+ rect.x = stableX + w;
+ end = token.documentToToken(pos);
+
+ if (text[end]=='\t') {
+ rect.width = fm.charWidth(' ');
+ }
+ else {
+ rect.width = fm.charWidth(text[end]);
+ }
+
+ return rect;
+
+ }
+
+ // If this token does not contain the position for which to get
+ // the bounding box...
+ else {
+ s.array = token.text;
+ s.offset = token.textOffset;
+ s.count = token.textCount;
+ stableX += Utilities.getTabbedTextWidth(s, fm, stableX, e,
+ token.offset);
+ }
+
+ token = token.getNextToken();
+
+ }
+
+ // If we didn't find anything, we're at the end of the line. Return
+ // a width of 1 (so selection highlights don't extend way past line's
+ // text). A ConfigurableCaret will know to paint itself with a larger
+ // width.
+ rect.x = stableX;
+ rect.width = 1;
+ return rect;
+
+ }
+
+
+ /**
+ * Paints this token.
+ *
+ * @param g The graphics context in which to paint.
+ * @param x The x-coordinate at which to paint.
+ * @param y The y-coordinate at which to paint.
+ * @param host The text area this token is in.
+ * @param e How to expand tabs.
+ * @param clipStart The left boundary of the clip rectangle in which we're
+ * painting. This optimizes painting by allowing us to not paint
+ * when this token is "to the left" of the clip rectangle.
+ * @return The x-coordinate representing the end of the painted text.
+ */
+ public float paint(Graphics2D g, float x, float y, RSyntaxTextArea host,
+ TabExpander e, float clipStart) {
+
+ int origX = (int)x;
+ int end = textOffset + textCount;
+ float nextX = x;
+ int flushLen = 0;
+ int flushIndex = textOffset;
+ Color fg = host.getForegroundForToken(this);
+ Color bg = host.getBackgroundForTokenType(type);
+ g.setFont(host.getFontForTokenType(type));
+ FontMetrics fm = host.getFontMetricsForTokenType(type);
+
+ for (int i=textOffset; i 0) {
+ g.setColor(fg);
+ g.drawChars(text, flushIndex, flushLen, (int)x,(int)y);
+ flushLen = 0;
+ }
+ flushIndex = i + 1;
+ x = nextX;
+ break;
+ default:
+ flushLen += 1;
+ break;
+ }
+ }
+
+ nextX = x+fm.charsWidth(text, flushIndex,flushLen);
+
+ if (flushLen>0 && nextX>=clipStart) {
+ if (bg!=null) {
+ paintBackground(x,y, nextX-x,fm.getHeight(),
+ g, fm.getAscent(), host, bg);
+ }
+ g.setColor(fg);
+ g.drawChars(text, flushIndex, flushLen, (int)x,(int)y);
+ }
+
+ if (host.getUnderlineForToken(this)) {
+ g.setColor(fg);
+ int y2 = (int)(y+1);
+ g.drawLine(origX,y2, (int)nextX,y2);
+ }
+
+ // Don't check if it's whitespace - some TokenMakers may return types
+ // other than Token.WHITESPACE for spaces (such as Token.IDENTIFIER).
+ // This also allows us to paint tab lines for MLC's.
+ if (host.getPaintTabLines() && origX==host.getMargin().left) {// && isWhitespace()) {
+ paintTabLines(origX, (int)y, (int)nextX, g, e, host);
+ }
+
+ return nextX;
+
+ }
+
+
+}
Index: /other-projects/gli-rsyntax-textarea/src/java/org/fife/ui/rsyntaxtextarea/DefaultTokenFactory.java
===================================================================
--- /other-projects/gli-rsyntax-textarea/src/java/org/fife/ui/rsyntaxtextarea/DefaultTokenFactory.java (revision 25585)
+++ /other-projects/gli-rsyntax-textarea/src/java/org/fife/ui/rsyntaxtextarea/DefaultTokenFactory.java (revision 25585)
@@ -0,0 +1,167 @@
+/*
+ * 10/28/2004
+ *
+ * DefaultTokenFactory.java - Default token factory.
+ *
+ * This library is distributed under a modified BSD license. See the included
+ * RSyntaxTextArea.License.txt file for details.
+ */
+package org.fife.ui.rsyntaxtextarea;
+
+import javax.swing.text.Segment;
+
+
+/**
+ * This class generates tokens for a {@link TokenMaker}. This class is here
+ * because it reuses tokens when they aren't needed anymore to prevent
+ * This class doesn't actually create new tokens every time
+ * createToken
is called. Instead, it internally keeps a stack of
+ * available already-created tokens. When more tokens are needed to properly
+ * display a line, more tokens are added to the available stack. This saves
+ * from needless repetitive memory allocation. However, it makes it IMPERATIVE
+ * that users call resetTokenList
when creating a new token list so
+ * that the token maker can keep an accurate list of available tokens.
+ *
+ * NOTE: This class should only be used by {@link TokenMaker}; nobody else
+ * needs it!
+ *
+ * @author Robert Futrell
+ * @version 0.1
+ */
+class DefaultTokenFactory implements TokenFactory {
+
+ private int size;
+ private int increment;
+ private Token[] tokenList;
+ private int currentFreeToken;
+
+ protected static final int DEFAULT_START_SIZE = 30;
+ protected static final int DEFAULT_INCREMENT = 10;
+
+
+ /**
+ * Cosnstructor.
+ */
+ public DefaultTokenFactory() {
+ this(DEFAULT_START_SIZE, DEFAULT_INCREMENT);
+ }
+
+
+ /**
+ * Constructor.
+ *
+ * @param size The initial number of tokens in this factory.
+ * @param increment How many tokens to increment by when the stack gets
+ * empty.
+ */
+ public DefaultTokenFactory(int size, int increment) {
+
+ this.size = size;
+ this.increment = increment;
+ this.currentFreeToken = 0;
+
+ // Give us some tokens to initially work with.
+ tokenList = new Token[size];
+ for (int i=0; iTokenMaker every time a token list is generated for
+ * a new line so the tokens can be reused.
+ */
+ public void resetAllTokens() {
+ currentFreeToken = 0;
+ }
+
+
+}
Index: /other-projects/gli-rsyntax-textarea/src/java/org/fife/ui/rsyntaxtextarea/DefaultTokenMakerFactory.java
===================================================================
--- /other-projects/gli-rsyntax-textarea/src/java/org/fife/ui/rsyntaxtextarea/DefaultTokenMakerFactory.java (revision 25585)
+++ /other-projects/gli-rsyntax-textarea/src/java/org/fife/ui/rsyntaxtextarea/DefaultTokenMakerFactory.java (revision 25585)
@@ -0,0 +1,81 @@
+/*
+ * 12/14/2008
+ *
+ * DefaultTokenMakerFactory.java - The default TokenMaker factory.
+ *
+ * This library is distributed under a modified BSD license. See the included
+ * RSyntaxTextArea.License.txt file for details.
+ */
+package org.fife.ui.rsyntaxtextarea;
+
+import java.util.HashMap;
+import java.util.Map;
+
+
+/**
+ * The default implementation of TokenMakerFactory
. This factory
+ * can create {@link TokenMaker}s for all languages known to
+ * {@link RSyntaxTextArea}.
+ *
+ * @author Robert Futrell
+ * @version 1.0
+ */
+class DefaultTokenMakerFactory extends AbstractTokenMakerFactory
+ implements SyntaxConstants {
+
+
+ /**
+ * Creates and returns a mapping from keys to the names of
+ * {@link TokenMaker} implementation classes. When
+ * {@link #getTokenMaker(String)} is called with a key defined in this
+ * map, a TokenMaker
of the corresponding type is returned.
+ *
+ * @return The map.
+ */
+ protected Map createTokenMakerKeyToClassNameMap() {
+
+ HashMap map = new HashMap();
+
+ String pkg = "org.fife.ui.rsyntaxtextarea.modes.";
+
+ map.put(SYNTAX_STYLE_NONE, pkg + "PlainTextTokenMaker");
+ map.put(SYNTAX_STYLE_ACTIONSCRIPT, pkg + "ActionScriptTokenMaker");
+ map.put(SYNTAX_STYLE_ASSEMBLER_X86, pkg + "AssemblerX86TokenMaker");
+ map.put(SYNTAX_STYLE_BBCODE, pkg + "BBCodeTokenMaker");
+ map.put(SYNTAX_STYLE_C, pkg + "CTokenMaker");
+ map.put(SYNTAX_STYLE_CLOJURE, pkg + "ClojureTokenMaker");
+ map.put(SYNTAX_STYLE_CPLUSPLUS, pkg + "CPlusPlusTokenMaker");
+ map.put(SYNTAX_STYLE_CSHARP, pkg + "CSharpTokenMaker");
+ map.put(SYNTAX_STYLE_CSS, pkg + "CSSTokenMaker");
+ map.put(SYNTAX_STYLE_DELPHI, pkg + "DelphiTokenMaker");
+ map.put(SYNTAX_STYLE_DTD, pkg + "DtdTokenMaker");
+ map.put(SYNTAX_STYLE_FORTRAN, pkg + "FortranTokenMaker");
+ map.put(SYNTAX_STYLE_GROOVY, pkg + "GroovyTokenMaker");
+ map.put(SYNTAX_STYLE_HTML, pkg + "HTMLTokenMaker");
+ map.put(SYNTAX_STYLE_JAVA, pkg + "JavaTokenMaker");
+ map.put(SYNTAX_STYLE_JAVASCRIPT, pkg + "JavaScriptTokenMaker");
+ map.put(SYNTAX_STYLE_JSP, pkg + "JSPTokenMaker");
+ map.put(SYNTAX_STYLE_LATEX, pkg + "LatexTokenMaker");
+ map.put(SYNTAX_STYLE_LISP, pkg + "LispTokenMaker");
+ map.put(SYNTAX_STYLE_LUA, pkg + "LuaTokenMaker");
+ map.put(SYNTAX_STYLE_MAKEFILE, pkg + "MakefileTokenMaker");
+ map.put(SYNTAX_STYLE_MXML, pkg + "MxmlTokenMaker");
+ map.put(SYNTAX_STYLE_PERL, pkg + "PerlTokenMaker");
+ map.put(SYNTAX_STYLE_PHP, pkg + "PHPTokenMaker");
+ map.put(SYNTAX_STYLE_PROPERTIES_FILE, pkg + "PropertiesFileTokenMaker");
+ map.put(SYNTAX_STYLE_PYTHON, pkg + "PythonTokenMaker");
+ map.put(SYNTAX_STYLE_RUBY, pkg + "RubyTokenMaker");
+ map.put(SYNTAX_STYLE_SAS, pkg + "SASTokenMaker");
+ map.put(SYNTAX_STYLE_SCALA, pkg + "ScalaTokenMaker");
+ map.put(SYNTAX_STYLE_SQL, pkg + "SQLTokenMaker");
+ map.put(SYNTAX_STYLE_TCL, pkg + "TclTokenMaker");
+ map.put(SYNTAX_STYLE_UNIX_SHELL, pkg + "UnixShellTokenMaker");
+ map.put(SYNTAX_STYLE_WINDOWS_BATCH, pkg + "WindowsBatchTokenMaker");
+ map.put(SYNTAX_STYLE_XML, pkg + "XMLTokenMaker");
+
+ return map;
+
+ }
+
+
+}
Index: /other-projects/gli-rsyntax-textarea/src/java/org/fife/ui/rsyntaxtextarea/DocumentRange.java
===================================================================
--- /other-projects/gli-rsyntax-textarea/src/java/org/fife/ui/rsyntaxtextarea/DocumentRange.java (revision 25585)
+++ /other-projects/gli-rsyntax-textarea/src/java/org/fife/ui/rsyntaxtextarea/DocumentRange.java (revision 25585)
@@ -0,0 +1,39 @@
+/*
+ * 08/11/2009
+ *
+ * DocumentRange.java - A range of text in a document.
+ *
+ * This library is distributed under a modified BSD license. See the included
+ * RSyntaxTextArea.License.txt file for details.
+ */
+package org.fife.ui.rsyntaxtextarea;
+
+
+/**
+ * A range of text in a document.
+ *
+ * @author Robert Futrell
+ * @version 1.0
+ */
+public interface DocumentRange {
+
+
+ /**
+ * Gets the end offset of the range.
+ *
+ * @return The end offset.
+ * @see #getStartOffset()
+ */
+ public int getEndOffset();
+
+
+ /**
+ * Gets the starting offset of the range.
+ *
+ * @return The starting offset.
+ * @see #getEndOffset()
+ */
+ public int getStartOffset();
+
+
+}
Index: /other-projects/gli-rsyntax-textarea/src/java/org/fife/ui/rsyntaxtextarea/ErrorStrip.java
===================================================================
--- /other-projects/gli-rsyntax-textarea/src/java/org/fife/ui/rsyntaxtextarea/ErrorStrip.java (revision 25585)
+++ /other-projects/gli-rsyntax-textarea/src/java/org/fife/ui/rsyntaxtextarea/ErrorStrip.java (revision 25585)
@@ -0,0 +1,766 @@
+/*
+ * 08/10/2009
+ *
+ * ErrorStrip.java - A component that can visually show Parser messages (syntax
+ * errors, etc.) in an RSyntaxTextArea.
+ *
+ * This library is distributed under a modified BSD license. See the included
+ * RSyntaxTextArea.License.txt file for details.
+ */
+package org.fife.ui.rsyntaxtextarea;
+
+import java.awt.Color;
+import java.awt.Component;
+import java.awt.Cursor;
+import java.awt.Dimension;
+import java.awt.Graphics;
+import java.awt.Rectangle;
+import java.awt.event.MouseAdapter;
+import java.awt.event.MouseEvent;
+import java.beans.PropertyChangeEvent;
+import java.beans.PropertyChangeListener;
+import java.text.MessageFormat;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.ResourceBundle;
+import javax.swing.JComponent;
+import javax.swing.ToolTipManager;
+import javax.swing.UIManager;
+import javax.swing.event.CaretEvent;
+import javax.swing.event.CaretListener;
+import javax.swing.text.BadLocationException;
+
+import org.fife.ui.rsyntaxtextarea.parser.Parser;
+import org.fife.ui.rsyntaxtextarea.parser.ParserNotice;
+import org.fife.ui.rsyntaxtextarea.parser.TaskTagParser.TaskNotice;
+
+
+/**
+ * A component to sit alongside an {@link RSyntaxTextArea} that displays
+ * colored markers for locations of interest (parser errors, marked
+ * occurrences, etc.).
+ *
+ * ErrorStrip
s display ParserNotice
s from
+ * {@link Parser}s. Currently, the only way to get lines flagged in this
+ * component is to register a Parser
on an RSyntaxTextArea and
+ * return ParserNotice
s for each line to display an icon for.
+ * The severity of each notice must be at least the threshold set by
+ * {@link #setLevelThreshold(int)} to be displayed in this error strip. The
+ * default threshold is {@link ParserNotice#WARNING}.
+ *
+ * An ErrorStrip
can be added to a UI like so:
+ *
+ * textArea = createTextArea();
+ * textArea.addParser(new MyParser(textArea)); // Identifies lines to display
+ * scrollPane = new RTextScrollPane(textArea, true);
+ * ErrorStrip es = new ErrorStrip(textArea);
+ * JPanel temp = new JPanel(new BorderLayout());
+ * temp.add(scrollPane);
+ * temp.add(es, BorderLayout.LINE_END);
+ *
+ *
+ * @author Robert Futrell
+ * @version 0.5
+ */
+/*
+ * Possible improvements:
+ * 1. Handle marked occurrence changes separately from parser changes.
+ * For each property change, call a method that removes the notices
+ * being reloaded from the Markers (removing any Markers that are now
+ * "empty").
+ * 2. When 1.4 support is dropped, replace new Integer(int) with
+ * Integer.valueOf(int).
+ */
+public class ErrorStrip extends JComponent {
+
+ /**
+ * The text area.
+ */
+ private RSyntaxTextArea textArea;
+
+ /**
+ * Listens for events in this component.
+ */
+ private Listener listener;
+
+ /**
+ * Whether "marked occurrences" in the text area should be shown in this
+ * error strip.
+ */
+ private boolean showMarkedOccurrences;
+
+ /**
+ * Mapping of colors to brighter colors. This is kept to prevent
+ * unnecessary creation of the same Colors over and over.
+ */
+ private Map brighterColors;
+
+ /**
+ * Only notices of this severity (or worse) will be displayed in this
+ * error strip.
+ */
+ private int levelThreshold;
+
+ /**
+ * Whether the caret marker's location should be rendered.
+ */
+ private boolean followCaret;
+
+ /**
+ * The color to use for the caret marker.
+ */
+ private Color caretMarkerColor;
+
+ /**
+ * Where we paint the caret marker.
+ */
+ private int caretLineY;
+
+ /**
+ * The last location of the caret marker.
+ */
+ private int lastLineY;
+
+ /**
+ * The preferred width of this component.
+ */
+ private static final int PREFERRED_WIDTH = 14;
+
+ private static final String MSG = "org.fife.ui.rsyntaxtextarea.ErrorStrip";
+ private static final ResourceBundle msg = ResourceBundle.getBundle(MSG);
+
+
+ /**
+ * Constructor.
+ *
+ * @param textArea The text area we are examining.
+ */
+ public ErrorStrip(RSyntaxTextArea textArea) {
+ this.textArea = textArea;
+ listener = new Listener();
+ ToolTipManager.sharedInstance().registerComponent(this);
+ setLayout(null); // Manually layout Markers as they can overlap
+ addMouseListener(listener);
+ setShowMarkedOccurrences(true);
+ setLevelThreshold(ParserNotice.WARNING);
+ setFollowCaret(true);
+ setCaretMarkerColor(Color.BLACK);
+ }
+
+
+ /**
+ * Overridden so we only start listening for parser notices when this
+ * component (and presumably the text area) are visible.
+ */
+ public void addNotify() {
+ super.addNotify();
+ textArea.addCaretListener(listener);
+ textArea.addPropertyChangeListener(
+ RSyntaxTextArea.PARSER_NOTICES_PROPERTY, listener);
+ textArea.addPropertyChangeListener(
+ RSyntaxTextArea.MARK_OCCURRENCES_PROPERTY, listener);
+ textArea.addPropertyChangeListener(
+ RSyntaxTextArea.MARKED_OCCURRENCES_CHANGED_PROPERTY, listener);
+ refreshMarkers();
+ }
+
+
+ /**
+ * Manually manages layout since this component uses no layout manager.
+ */
+ public void doLayout() {
+ for (int i=0; iParserNotice class.
+ *
+ * @return The minimum severity.
+ * @see #setLevelThreshold(int)
+ */
+ public int getLevelThreshold() {
+ return levelThreshold;
+ }
+
+
+ /**
+ * Returns whether marked occurrences are shown in this error strip.
+ *
+ * @return Whether marked occurrences are shown.
+ * @see #setShowMarkedOccurrences(boolean)
+ */
+ public boolean getShowMarkedOccurrences() {
+ return showMarkedOccurrences;
+ }
+
+
+ /**
+ * {@inheritDoc}
+ */
+ public String getToolTipText(MouseEvent e) {
+ String text = null;
+ int line = yToLine(e.getY());
+ if (line>-1) {
+ text = msg.getString("Line");
+ // TODO: 1.5: Use Integer.valueOf(line)
+ text = MessageFormat.format(text,
+ new Object[] { new Integer(line) });
+ }
+ return text;
+ }
+
+
+ /**
+ * Returns the y-offset in this component corresponding to a line in the
+ * text component.
+ *
+ * @param line The line.
+ * @return The y-offset.
+ * @see #yToLine(int)
+ */
+ private int lineToY(int line) {
+ int h = textArea.getVisibleRect().height;
+ float lineCount = textArea.getLineCount();
+ return (int)((line/lineCount) * h) - 2;
+ }
+
+
+ /**
+ * Overridden to (possibly) draw the caret's position.
+ *
+ * @param g The graphics context.
+ */
+ protected void paintComponent(Graphics g) {
+ super.paintComponent(g);
+ if (caretLineY>-1) {
+ g.setColor(getCaretMarkerColor());
+ g.fillRect(0, caretLineY, getWidth(), 2);
+ }
+ }
+
+
+ /**
+ * Returns a possibly brighter component for a color.
+ *
+ * @param i An RGB component for a color (0-255).
+ * @return A possibly brighter value for the component.
+ */
+ private static final int possiblyBrighter(int i) {
+ if (i<255) {
+ i += (int)((255-i)*0.8f);
+ }
+ return i;
+ }
+
+
+ /**
+ * Refreshes the markers displayed in this error strip.
+ */
+ private void refreshMarkers() {
+
+ removeAll(); // listener is removed in Marker.removeNotify()
+ Map markerMap = new HashMap();
+
+ List notices = textArea.getParserNotices();
+ for (Iterator i=notices.iterator(); i.hasNext(); ) {
+ ParserNotice notice = (ParserNotice)i.next();
+ if (notice.getLevel()<=levelThreshold ||
+ (notice instanceof TaskNotice)) {
+ // 1.5: Use Integer.valueOf(notice.getLine())
+ Integer key = new Integer(notice.getLine());
+ Marker m = (Marker)markerMap.get(key);
+ if (m==null) {
+ m = new Marker(notice);
+ m.addMouseListener(listener);
+ markerMap.put(key, m);
+ add(m);
+ }
+ else {
+ m.addNotice(notice);
+ }
+ }
+ }
+
+ if (getShowMarkedOccurrences() && textArea.getMarkOccurrences()) {
+ List occurrences = textArea.getMarkedOccurrences();
+ for (Iterator i=occurrences.iterator(); i.hasNext(); ) {
+ DocumentRange range = (DocumentRange)i.next();
+ int line = 0;
+ try {
+ line = textArea.getLineOfOffset(range.getStartOffset());
+ } catch (BadLocationException ble) { // Never happens
+ continue;
+ }
+ ParserNotice notice = new MarkedOccurrenceNotice(range);
+ // 1.5: Use Integer.valueOf(notice.getLine())
+ Integer key = new Integer(line);
+ Marker m = (Marker)markerMap.get(key);
+ if (m==null) {
+ m = new Marker(notice);
+ m.addMouseListener(listener);
+ markerMap.put(key, m);
+ add(m);
+ }
+ else {
+ if (!m.containsMarkedOccurence()) {
+ m.addNotice(notice);
+ }
+ }
+ }
+ }
+
+ revalidate();
+ repaint();
+
+ }
+
+
+ /**
+ * {@inheritDoc}
+ */
+ public void removeNotify() {
+ super.removeNotify();
+ textArea.removeCaretListener(listener);
+ textArea.removePropertyChangeListener(
+ RSyntaxTextArea.PARSER_NOTICES_PROPERTY, listener);
+ textArea.removePropertyChangeListener(
+ RSyntaxTextArea.MARK_OCCURRENCES_PROPERTY, listener);
+ textArea.removePropertyChangeListener(
+ RSyntaxTextArea.MARKED_OCCURRENCES_CHANGED_PROPERTY, listener);
+ }
+
+
+ /**
+ * Sets the color to use when painting the caret marker.
+ *
+ * @param color The new caret marker color.
+ * @see #getCaretMarkerColor()
+ */
+ public void setCaretMarkerColor(Color color) {
+ if (color!=null) {
+ caretMarkerColor = color;
+ listener.caretUpdate(null); // Force repaint
+ }
+ }
+
+
+ /**
+ * Toggles whether the caret's current location should be drawn.
+ *
+ * @param follow Whether the caret's current location should be followed.
+ * @see #getFollowCaret()
+ */
+ public void setFollowCaret(boolean follow) {
+ if (followCaret!=follow) {
+ if (followCaret) {
+ repaint(0,caretLineY, getWidth(),2); // Erase
+ }
+ caretLineY = -1;
+ lastLineY = -1;
+ followCaret = follow;
+ listener.caretUpdate(null); // Possibly repaint
+ }
+ }
+
+
+ /**
+ * Sets the minimum severity a parser notice must be for it to be displayed
+ * in this error strip. This should be one of the constants defined in
+ * the ParserNotice
class. The default value is
+ * {@link ParserNotice#WARNING}.
+ *
+ * @param level The new severity threshold.
+ * @see #getLevelThreshold()
+ * @see ParserNotice
+ */
+ public void setLevelThreshold(int level) {
+ levelThreshold = level;
+ if (isDisplayable()) {
+ refreshMarkers();
+ }
+ }
+
+
+ /**
+ * Sets whether marked occurrences are shown in this error strip.
+ *
+ * @param show Whether to show marked occurrences.
+ * @see #getShowMarkedOccurrences()
+ */
+ public void setShowMarkedOccurrences(boolean show) {
+ if (show!=showMarkedOccurrences) {
+ showMarkedOccurrences = show;
+ if (isDisplayable()) { // Skip this when we're first created
+ refreshMarkers();
+ }
+ }
+ }
+
+
+ /**
+ * Returns the line in the text area corresponding to a y-offset in this
+ * component.
+ *
+ * @param y The y-offset.
+ * @return The line.
+ * @see #lineToY(int)
+ */
+ private final int yToLine(int y) {
+ int line = -1;
+ int h = textArea.getVisibleRect().height;
+ if (y-1) {
+ try {
+ int offs = textArea.getLineStartOffset(line);
+ textArea.setCaretPosition(offs);
+ } catch (BadLocationException ble) { // Never happens
+ UIManager.getLookAndFeel().provideErrorFeedback(textArea);
+ }
+ }
+
+ }
+
+ public void propertyChange(PropertyChangeEvent e) {
+
+ String propName = e.getPropertyName();
+
+ // If they change whether marked occurrences are visible in editor
+ if (RSyntaxTextArea.MARK_OCCURRENCES_PROPERTY.equals(propName)) {
+ if (getShowMarkedOccurrences()) {
+ refreshMarkers();
+ }
+ }
+
+ // If parser notices changed.
+ else if (RSyntaxTextArea.PARSER_NOTICES_PROPERTY.equals(propName)) {
+ refreshMarkers();
+ }
+
+ // If marked occurrences changed.
+ else if (RSyntaxTextArea.MARKED_OCCURRENCES_CHANGED_PROPERTY.
+ equals(propName)) {
+ if (getShowMarkedOccurrences()) {
+ refreshMarkers();
+ }
+ }
+
+ }
+
+ }
+
+
+private static final Color COLOR = new Color(220, 220, 220);
+ /**
+ * A notice that wraps a "marked occurrence."
+ */
+ private class MarkedOccurrenceNotice implements ParserNotice {
+
+ private DocumentRange range;
+
+ public MarkedOccurrenceNotice(DocumentRange range) {
+ this.range = range;
+ }
+
+ public int compareTo(Object o) {
+ return 0; // Value doesn't matter
+ }
+
+ public boolean containsPosition(int pos) {
+ return pos>=range.getStartOffset() && pos 1
+ StringBuffer sb = new StringBuffer("");
+ sb.append(msg.getString("MultipleMarkers"));
+ sb.append("
");
+ for (int i=0; i");
+ }
+ text = sb.toString();
+ }
+
+ return text;
+
+ }
+
+ protected void mouseClicked(MouseEvent e) {
+ ParserNotice pn = (ParserNotice)notices.get(0);
+ int offs = pn.getOffset();
+ int len = pn.getLength();
+ if (offs>-1 && len>-1) { // These values are optional
+ textArea.setSelectionStart(offs);
+ textArea.setSelectionEnd(offs+len);
+ }
+ else {
+ int line = pn.getLine();
+ try {
+ offs = textArea.getLineStartOffset(line);
+ textArea.setCaretPosition(offs);
+ } catch (BadLocationException ble) { // Never happens
+ UIManager.getLookAndFeel().provideErrorFeedback(textArea);
+ }
+ }
+ }
+
+ protected void paintComponent(Graphics g) {
+
+ // TODO: Give "priorities" and always pick color of a notice with
+ // highest priority (e.g. parsing errors will usually be red).
+
+ Color borderColor = getColor();
+ if (borderColor==null) {
+ borderColor = Color.DARK_GRAY;
+ }
+ Color fillColor = getBrighterColor(borderColor);
+
+ int w = getWidth();
+ int h = getHeight();
+
+ g.setColor(fillColor);
+ g.fillRect(0,0, w,h);
+
+ g.setColor(borderColor);
+ g.drawRect(0,0, w-1,h-1);
+
+ }
+
+ public void removeNotify() {
+ super.removeNotify();
+ ToolTipManager.sharedInstance().unregisterComponent(this);
+ removeMouseListener(listener);
+ }
+
+ public void updateLocation() {
+ int line = ((ParserNotice)notices.get(0)).getLine();
+ int y = lineToY(line);
+ setLocation(2, y);
+ }
+
+ }
+
+
+}
Index: /other-projects/gli-rsyntax-textarea/src/java/org/fife/ui/rsyntaxtextarea/FileFileLocation.java
===================================================================
--- /other-projects/gli-rsyntax-textarea/src/java/org/fife/ui/rsyntaxtextarea/FileFileLocation.java (revision 25585)
+++ /other-projects/gli-rsyntax-textarea/src/java/org/fife/ui/rsyntaxtextarea/FileFileLocation.java (revision 25585)
@@ -0,0 +1,114 @@
+/*
+ * 11/13/2008
+ *
+ * FileFileLocation.java - The location of a local file.
+ *
+ * This library is distributed under a modified BSD license. See the included
+ * RSyntaxTextArea.License.txt file for details.
+ */
+package org.fife.ui.rsyntaxtextarea;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.io.InputStream;
+import java.io.IOException;
+import java.io.OutputStream;
+
+
+/**
+ * The location of a local file.
+ *
+ * @author Robert Futrell
+ * @version 1.0
+ */
+class FileFileLocation extends FileLocation {
+
+ /**
+ * The file. This may or may not actually exist.
+ */
+ private File file;
+
+
+ /**
+ * Constructor.
+ *
+ * @param file The local file.
+ */
+ public FileFileLocation(File file) {
+ try {
+ // Useful on Windows and OS X.
+ this.file = file.getCanonicalFile();
+ } catch (IOException ioe) {
+ this.file = file;
+ }
+ }
+
+
+ /**
+ * {@inheritDoc}
+ */
+ protected long getActualLastModified() {
+ return file.lastModified();
+ }
+
+
+ /**
+ * Returns the full path to the file.
+ *
+ * @return The full path to the file.
+ * @see #getFileName()
+ */
+ public String getFileFullPath() {
+ return file.getAbsolutePath();
+ }
+
+
+ /**
+ * {@inheritDoc}
+ */
+ public String getFileName() {
+ return file.getName();
+ }
+
+
+ /**
+ * {@inheritDoc}
+ */
+ protected InputStream getInputStream() throws IOException {
+ return new FileInputStream(file);
+ }
+
+
+ /**
+ * {@inheritDoc}
+ */
+ protected OutputStream getOutputStream() throws IOException {
+ return new FileOutputStream(file);
+ }
+
+
+ /**
+ * Always returns true
.
+ *
+ * @return true
always.
+ * @see #isLocalAndExists()
+ */
+ public boolean isLocal() {
+ return true;
+ }
+
+
+ /**
+ * Since file locations of this type are guaranteed to be local, this
+ * method returns whether the file exists.
+ *
+ * @return Whether this local file actually exists.
+ * @see #isLocal()
+ */
+ public boolean isLocalAndExists() {
+ return file.exists();
+ }
+
+
+}
Index: /other-projects/gli-rsyntax-textarea/src/java/org/fife/ui/rsyntaxtextarea/FileLocation.java
===================================================================
--- /other-projects/gli-rsyntax-textarea/src/java/org/fife/ui/rsyntaxtextarea/FileLocation.java (revision 25585)
+++ /other-projects/gli-rsyntax-textarea/src/java/org/fife/ui/rsyntaxtextarea/FileLocation.java (revision 25585)
@@ -0,0 +1,141 @@
+/*
+ * 11/13/2008
+ *
+ * FileLocation.java - Holds the location of a local or remote file.
+ *
+ * This library is distributed under a modified BSD license. See the included
+ * RSyntaxTextArea.License.txt file for details.
+ */
+package org.fife.ui.rsyntaxtextarea;
+
+import java.io.File;
+import java.io.InputStream;
+import java.io.IOException;
+import java.io.OutputStream;
+import java.net.URL;
+
+
+/**
+ * Holds the location of a local or remote file. This provides a common way
+ * to read, write, and check properties of both local and remote files.
+ *
+ * @author Robert Futrell
+ * @version 1.0
+ */
+public abstract class FileLocation {
+
+
+ /**
+ * Creates a {@link FileLocation} instance for the specified local file.
+ *
+ * @param fileFullPath The full path to a local file.
+ * @return The file's location.
+ */
+ public static FileLocation create(String fileFullPath) {
+ return new FileFileLocation(new File(fileFullPath));
+ }
+
+
+ /**
+ * Creates a {@link FileLocation} instance for the specified local file.
+ *
+ * @param file A local file.
+ * @return The file's location.
+ */
+ public static FileLocation create(File file) {
+ return new FileFileLocation(file);
+ }
+
+
+ /**
+ * Creates a {@link FileLocation} instance for the specified file.
+ *
+ * @param url The URL of a file.
+ * @return The file's location.
+ */
+ public static FileLocation create(URL url) {
+ if ("file".equalsIgnoreCase(url.getProtocol())) {
+ return new FileFileLocation(new File(url.getPath()));
+ }
+ return new URLFileLocation(url);
+ }
+
+
+ /**
+ * Returns the last time this file was modified, or
+ * {@link TextEditorPane#LAST_MODIFIED_UNKNOWN} if this value cannot be
+ * computed (such as for a remote file).
+ *
+ * @return The last time this file was modified.
+ */
+ protected abstract long getActualLastModified();
+
+
+ /**
+ * Returns the full path to the file. This will be stripped of
+ * sensitive information such as passwords for remote files.
+ *
+ * @return The full path to the file.
+ * @see #getFileName()
+ */
+ public abstract String getFileFullPath();
+
+
+ /**
+ * Returns the name of the file.
+ *
+ * @return The name of the file.
+ * @see #getFileFullPath()
+ */
+ public abstract String getFileName();
+
+
+ /**
+ * Opens an input stream for reading from this file.
+ *
+ * @return The input stream.
+ * @throws IOException If the file does not exist, or some other IO error
+ * occurs.
+ */
+ protected abstract InputStream getInputStream() throws IOException;
+
+
+ /**
+ * Opens an output stream for writing this file.
+ *
+ * @return An output stream.
+ * @throws IOException If an IO error occurs.
+ */
+ protected abstract OutputStream getOutputStream() throws IOException;
+
+
+ /**
+ * Returns whether this file location is a local file.
+ *
+ * @return Whether this is a local file.
+ * @see #isLocalAndExists()
+ */
+ public abstract boolean isLocal();
+
+
+ /**
+ * Returns whether this file location is a local file that already
+ * exists.
+ *
+ * @return Whether this file is local and actually exists.
+ * @see #isLocal()
+ */
+ public abstract boolean isLocalAndExists();
+
+
+ /**
+ * Returns whether this file location is a remote location.
+ *
+ * @return Whether this is a remote file location.
+ */
+ public boolean isRemote() {
+ return !isLocal();
+ }
+
+
+}
Index: /other-projects/gli-rsyntax-textarea/src/java/org/fife/ui/rsyntaxtextarea/FoldingAwareIconRowHeader.java
===================================================================
--- /other-projects/gli-rsyntax-textarea/src/java/org/fife/ui/rsyntaxtextarea/FoldingAwareIconRowHeader.java (revision 25585)
+++ /other-projects/gli-rsyntax-textarea/src/java/org/fife/ui/rsyntaxtextarea/FoldingAwareIconRowHeader.java (revision 25585)
@@ -0,0 +1,235 @@
+/*
+ * 03/07/2012
+ *
+ * FoldingAwareIconRowHeader - Icon row header that paints itself correctly
+ * even when code folding is enabled.
+ *
+ * This library is distributed under a modified BSD license. See the included
+ * RSyntaxTextArea.License.txt file for details.
+ */
+package org.fife.ui.rsyntaxtextarea;
+
+import java.awt.Color;
+import java.awt.Graphics;
+import java.awt.Point;
+import javax.swing.Icon;
+import javax.swing.text.BadLocationException;
+import javax.swing.text.Document;
+import javax.swing.text.Element;
+
+import org.fife.ui.rsyntaxtextarea.folding.FoldManager;
+import org.fife.ui.rtextarea.GutterIconInfo;
+import org.fife.ui.rtextarea.IconRowHeader;
+
+
+/**
+ * A row header component that takes code folding into account when painting
+ * itself.
+ *
+ * @author Robert Futrell
+ * @version 1.0
+ */
+public class FoldingAwareIconRowHeader extends IconRowHeader {
+
+
+ /**
+ * Constructor.
+ *
+ * @param textArea The parent text area.
+ */
+ public FoldingAwareIconRowHeader(RSyntaxTextArea textArea) {
+ super(textArea);
+ }
+
+
+ /**
+ * {@inheritDoc}
+ */
+ protected void paintComponent(Graphics g) {
+
+ // When line wrap is not enabled, take the faster code path.
+ if (textArea==null) {
+ return;
+ }
+ RSyntaxTextArea rsta = (RSyntaxTextArea)textArea;
+ FoldManager fm = rsta.getFoldManager();
+ if (!fm.isCodeFoldingSupportedAndEnabled()) {
+ super.paintComponent(g);
+ return;
+ }
+
+ visibleRect = g.getClipBounds(visibleRect);
+ if (visibleRect==null) { // ???
+ visibleRect = getVisibleRect();
+ }
+ //System.out.println("IconRowHeader repainting: " + visibleRect);
+ if (visibleRect==null) {
+ return;
+ }
+
+ g.setColor(getBackground());
+ g.fillRect(0,visibleRect.y, width,visibleRect.height);
+
+ if (textArea.getLineWrap()) {
+ paintComponentWrapped(g);
+ return;
+ }
+
+ Document doc = textArea.getDocument();
+ Element root = doc.getDefaultRootElement();
+ textAreaInsets = textArea.getInsets(textAreaInsets);
+
+ // Get the first line to paint.
+ int cellHeight = textArea.getLineHeight();
+ int topLine = (visibleRect.y-textAreaInsets.top)/cellHeight;
+ topLine += fm.getHiddenLineCountAbove(topLine, true);
+
+ // Get where to start painting (top of the row).
+ // We need to be "scrolled up" up just enough for the missing part of
+ // the first line.
+ int y = topLine*cellHeight + textAreaInsets.top;
+
+ // Paint the active line range.
+ if (activeLineRangeStart>-1 && activeLineRangeEnd>-1) {
+ Color activeLineRangeColor = getActiveLineRangeColor();
+ g.setColor(activeLineRangeColor);
+ try {
+
+ int y1 = rsta.yForLine(activeLineRangeStart);
+ if (y1>-1) { // Not in a collapsed fold...
+
+ int y2 = rsta.yForLine(activeLineRangeEnd);
+ if (y2==-1) { // In a collapsed fold
+ y2 = y1;
+ }
+ y2 += cellHeight - 1;
+
+ int j = y1;
+ while (j<=y2) {
+ int yEnd = Math.min(y2, j+getWidth());
+ int xEnd = yEnd-j;
+ g.drawLine(0,j, xEnd,yEnd);
+ j += 2;
+ }
+
+ int i = 2;
+ while (i=y && y1=y && y2=0; i--) { // Last to first
+ GutterIconInfo ti = getTrackingIcon(i);
+ int offs = ti.getMarkedOffset();
+ if (offs>=0 && offs<=doc.getLength()) {
+ int line = root.getElementIndex(offs);
+ if (line<=lastLine && line>=topLine) {
+ try {
+ int lineY = rsta.yForLine(line);
+ if (lineY>=y && lineY=0; i--) { // Last to first
+ GutterIconInfo ti = getTrackingIcon(i);
+ int offs = ti.getMarkedOffset();
+ if (offs>=0 && offs<=doc.getLength()) {
+ int line = root.getElementIndex(offs);
+ if (line<=lastLine && line>=topLine) {
+ try {
+ int lineY = rsta.yForLine(line);
+ if (lineY>=topY && lineY