You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jena.apache.org by an...@apache.org on 2011/08/29 22:24:55 UTC
svn commit: r1162982 [1/2] - in /incubator/jena/Jena2/ARQ/trunk: Grammar/
Grammar/Archive/ src/org/openjena/atlas/json/io/parserjavacc/javacc/
Author: andy
Date: Mon Aug 29 20:24:55 2011
New Revision: 1162982
URL: http://svn.apache.org/viewvc?rev=1162982&view=rev
Log:
Move JavaCC JSON parser json.jj files.
Added:
incubator/jena/Jena2/ARQ/trunk/Grammar/Archive/rdql-arq.jjt
incubator/jena/Jena2/ARQ/trunk/Grammar/json (with props)
incubator/jena/Jena2/ARQ/trunk/Grammar/json.jj
Modified:
incubator/jena/Jena2/ARQ/trunk/src/org/openjena/atlas/json/io/parserjavacc/javacc/JSON_Parser.java
incubator/jena/Jena2/ARQ/trunk/src/org/openjena/atlas/json/io/parserjavacc/javacc/JSON_ParserConstants.java
incubator/jena/Jena2/ARQ/trunk/src/org/openjena/atlas/json/io/parserjavacc/javacc/JSON_ParserTokenManager.java
incubator/jena/Jena2/ARQ/trunk/src/org/openjena/atlas/json/io/parserjavacc/javacc/JavaCharStream.java
incubator/jena/Jena2/ARQ/trunk/src/org/openjena/atlas/json/io/parserjavacc/javacc/ParseException.java
incubator/jena/Jena2/ARQ/trunk/src/org/openjena/atlas/json/io/parserjavacc/javacc/Token.java
incubator/jena/Jena2/ARQ/trunk/src/org/openjena/atlas/json/io/parserjavacc/javacc/TokenMgrError.java
Added: incubator/jena/Jena2/ARQ/trunk/Grammar/Archive/rdql-arq.jjt
URL: http://svn.apache.org/viewvc/incubator/jena/Jena2/ARQ/trunk/Grammar/Archive/rdql-arq.jjt?rev=1162982&view=auto
==============================================================================
--- incubator/jena/Jena2/ARQ/trunk/Grammar/Archive/rdql-arq.jjt (added)
+++ incubator/jena/Jena2/ARQ/trunk/Grammar/Archive/rdql-arq.jjt Mon Aug 29 20:24:55 2011
@@ -0,0 +1,903 @@
+/**
+ * RDQL for ARQ
+ *
+ * Author: Andy Seaborne andy.seaborne@hp.com
+ * Date: June 2004
+ *
+ * (c) Copyright 2001, 2002, 2003, 2004, 2005, 2006, 2007
+ Hewlett-Packard Development Company, LP
+ * All rights reserved.
+ * See end of file for details.
+ *
+ * Constraint expression is derived from Java :
+ * example java1.2-a.jj grammer in JavaCC distribution
+ */
+
+options
+{
+ // Unicode characters outside of 0-0x00FF must be entered as \u1234
+ // Javacc does not provide mixed width charactser streams.
+ JAVA_UNICODE_ESCAPE = true;
+ UNICODE_INPUT = false ;
+
+ STATIC = false ;
+// DEBUG_PARSER = true ;
+// DEBUG_TOKEN_MANAGER = true ;
+
+ // JJTree options
+ MULTI = true ;
+// NODE_DEFAULT_VOID = false ;
+// BUILD_NODE_FILES = false ;
+ NODE_PREFIX = "Q_" ;
+ NODE_PACKAGE = "com.hp.hpl.jena.sparql.lang.rdql" ;
+ NODE_USES_PARSER = false ;
+}
+
+PARSER_BEGIN(RDQLParser)
+/*
+ * (c) Copyright 2001, 2002, 2003, 2004, 2005, 2006, 2007 Hewlett-Packard Development Company, LP
+ */
+
+package com.hp.hpl.jena.sparql.lang.rdql ;
+
+public class RDQLParser
+{
+ public SimpleNode top()
+ {
+ return (SimpleNode)jjtree.rootNode() ;
+ }
+}
+PARSER_END(RDQLParser)
+
+
+/* WHITE SPACE */
+
+SKIP : { " " | "\t" | "\n" | "\r" | "\f" }
+// Need this because we may not be at the start of the identifier
+// when the mode is entered. For URIs, we enter that mode because
+// a suitable < is seen, similarly we exit on > so no skip necessary
+<READ_IDENTIFIER> SKIP : { " " | "\t" | "\n" | "\r" | "\f" }
+
+/* COMMENTS */
+
+MORE :
+{
+ "//" : IN_SINGLE_LINE_COMMENT
+|
+ "#" : IN_SINGLE_LINE_COMMENT
+|
+ "/*" : IN_MULTI_LINE_COMMENT
+}
+
+<IN_SINGLE_LINE_COMMENT>
+SPECIAL_TOKEN :
+{
+ <SINGLE_LINE_COMMENT: "\n" | "\r" | "\r\n" > : DEFAULT
+}
+
+<IN_MULTI_LINE_COMMENT>
+SPECIAL_TOKEN :
+{
+ <MULTI_LINE_COMMENT: "*/" > : DEFAULT
+}
+
+<IN_SINGLE_LINE_COMMENT,IN_MULTI_LINE_COMMENT>
+MORE :
+{
+ < ~[] >
+}
+
+
+/* LITERALS */
+
+TOKEN :
+{
+ < INTEGER_LITERAL:
+ <DECIMAL_LITERAL> (["l","L"])?
+ | <HEX_LITERAL> (["l","L"])?
+// | <OCTAL_LITERAL> (["l","L"])?
+ >
+|
+ // If octal permitted, should be ["1"-"9"] (["0"-"9"])*
+ < #DECIMAL_LITERAL: <DIGITS> >
+|
+ < #HEX_LITERAL: "0" ["x","X"] (["0"-"9","a"-"f","A"-"F"])+ >
+|
+ < FLOATING_POINT_LITERAL:
+ (["0"-"9"])+ "." (["0"-"9"])* (<EXPONENT>)? (["f","F","d","D"])?
+ | "." (["0"-"9"])+ (<EXPONENT>)? (["f","F","d","D"])?
+ | (["0"-"9"])+ <EXPONENT> (["f","F","d","D"])?
+ | (["0"-"9"])+ (<EXPONENT>)? ["f","F","d","D"]
+ >
+|
+ < #EXPONENT: ["e","E"] (["+","-"])? (["0"-"9"])+ >
+|
+/****
+ * No character literals
+ * And we allow single quoted strings
+ */
+
+ < STRING_LITERAL1:
+ "'"
+ ( (~["'","\\","\n","\r"])
+ | ("\\" ~["\n","\r"])
+ )*
+ "'"
+ >
+|
+ < STRING_LITERAL2:
+ "\""
+ ( (~["\"","\\","\n","\r"])
+ | ("\\" ~["\n","\r"])
+ )*
+ "\""
+ >
+}
+
+// Modes to read things that might be keywords as well.
+
+<READ_URI> TOKEN :
+{
+ <URI: ( ~[" ", "\n", "\r", ">", "\t"] )+ >
+}
+
+<READ_QNAME> TOKEN :
+{
+ <QNAME: <QNAME_PREFIX> ":" <QNAME_LNAME>>
+|
+ <QNAME_PREFIX: (["a"-"z"] | ["A"-"Z"] | ["0"-"9"] )+>
+|
+ <QNAME_LNAME: (["a"-"z"] | ["A"-"Z"] | ["0"-"9"] )+>
+}
+
+/* To go ...
+<READ_IDENTIFIER> TOKEN :
+{
+ <IDENTIFIER: (<LETTER>|<DIGIT>|"_"|"$"|".")+ >
+|
+ < LETTER: (["a"-"z"] | ["A"-"Z"])>
+|
+ < DIGIT: ["0"-"9"]>
+}
+*/
+
+/* Keywords : includes operators that are words and should be
+ * before general things like IDENTIFIER which swallow almost anything
+ */
+
+TOKEN [IGNORE_CASE] :
+{
+ < SELECT: "select" >
+|
+ < SOURCE: "source" >
+|
+ < FROM: "from" >
+|
+ < WHERE: "where" >
+|
+ < SUCHTHAT: "and" >
+|
+ < PREFIXES: "using" >
+|
+ < FOR: "for" >
+| < STR_EQ: "eq" >
+| < STR_NE: "ne" >
+| < STR_LANGEQ: "langeq" >
+}
+
+TOKEN :
+{
+ < BOOLEAN_LITERAL: "true" | "false" >
+|
+ < NULL_LITERAL: "null">
+|
+ < DIGITS: (["0"-"9"])+ >
+}
+
+// Notes:
+// XML 1.1 http://www.w3.org/TR/xml11/
+// XML Namespces 1.1 http://www.w3.org/TR/xml-names11/
+// Prefix ':' LocalPart
+// Prefix is an NCName
+// LocalPart is an NCName
+//
+// // An XML Name, minus the ":"
+// NCName ::= NCNameStartChar NCNameChar*
+// NCNameChar ::= NameChar - ':'
+// NCNameStartChar ::= NameStartChar - ':'
+
+// NameChar and NameSartChar defined in XML 1.1
+// NameStartChar := ":" | [A-Z] | "_" | [a-z] |
+// [#xC0-#x2FF] | [#x370-#x37D] | [#x37F-#x1FFF] |
+// [#x200C-#x200D] | [#x2070-#x218F] | [#x2C00-#x2FEF] |
+// [#x3001-#xD7FF] | [#xF900-#xEFFFF]
+// NameChar := NameStartChar | "-" | "." | [0-9] | #xB7 |
+// [#x0300-#x036F] | [#x203F-#x2040]
+
+TOKEN:
+{
+<NCName: (["A"-"Z"] | "_" | ["a"-"z"]|
+ ["\u00C0"-"\u02FF"] | ["\u0370"-"\u037D"] | ["\u037F"-"\u1FFF"] |
+ ["\u200C"-"\u200D"] | ["\u2070"-"\u218F"] | ["\u2C00"-"\u2FEF"] |
+ ["\u3001"-"\uD7FF"] | ["\uF900"-"\uFFFF"])
+
+ (["A"-"Z"] | "_" | ["a"-"z"]|
+ ["\u00C0"-"\u02FF"] | ["\u0370"-"\u037D"] | ["\u037F"-"\u1FFF"] |
+ ["\u200C"-"\u200D"] | ["\u2070"-"\u218F"] | ["\u2C00"-"\u2FEF"] |
+ ["\u3001"-"\uD7FF"] | ["\uF900"-"\uFFFF"] |
+ "-" | "." | ["0"-"9"] | "\u00B7" |
+ ["\u0300"-"\u036F"] | ["\u203F"-"\u2040"] )* >
+|
+<VAR: "?" <NCName>>
+
+}
+
+/* SEPARATORS */
+
+TOKEN :
+{
+ < LPAREN: "(" >
+| < RPAREN: ")" >
+| < LBRACE: "{" >
+| < RBRACE: "}" >
+| < LBRACKET: "[" >
+| < RBRACKET: "]" >
+| < SEMICOLON: ";" >
+| < COMMA: "," >
+| < DOT: "." >
+}
+
+/* OPERATORS */
+
+TOKEN :
+{
+ // ASSIGN is here so that the tokenizer will process it and
+ // the parser will flag an error. Otherwise, the tokenizer
+ // gives a less helpful message.
+ < ASSIGN: "=" >
+| < GT: ">" >
+| < LT: "<" >
+| < BANG: "!" >
+| < TILDE: "~" >
+| < HOOK: "?" >
+| < COLON: ":" >
+| < EQ: "==" >
+| < NEQ: "!=" >
+| < LE: "<=" > // Maybe: | "=>" >
+| < GE: ">=" > // Maybe: | "=<" >
+| < SC_OR: "||" >
+| < SC_AND: "&&" >
+//| < SC_XOR: "^^" >
+| < INCR: "++" >
+| < DECR: "--" >
+| < PLUS: "+" >
+| < MINUS: "-" >
+| < STAR: "*" >
+| < SLASH: "/" >
+| < BIT_AND: "&" >
+| < BIT_OR: "|" >
+| < BIT_XOR: "^" >
+| < REM: "%" >
+| < LSHIFT: "<<" >
+| < RSIGNEDSHIFT: ">>" >
+| < RUNSIGNEDSHIFT: ">>>" >
+// The tokens for string EQ and string NE are done before IDENTIFIER
+// to ensure that they are recognized as reserved words.
+| < STR_MATCH: ("=~"|"~~") >
+| < STR_NMATCH: "!~">
+| < DATATYPE: "^^">
+| < AT: "@">
+}
+
+// **** Debug point
+
+void CompilationUnit() #void :
+{}
+{
+ // The <EOF> tests for trailing junk
+ // but does not work for "//...<EOF>"
+ Query() <EOF>
+}
+
+// Optional comma
+void CommaOpt() #void :
+{}
+{
+ (<COMMA>)?
+}
+
+// **** Debug point
+
+void Query() :
+{}
+{
+ SelectClause()
+ ( SourceClause() )?
+ ( TriplePatternClause() ) ?
+ ( ConstraintClause() )?
+ ( PrefixesClause() ) ?
+}
+
+void SelectClause() :
+{}
+{
+ LOOKAHEAD(2)
+ <SELECT> Var() (CommaOpt() Var())*
+|
+ <SELECT> "*"
+}
+
+void SourceClause() :
+{}
+{
+ (<SOURCE> | <FROM>)
+ SourceSelector()
+ (CommaOpt() SourceSelector() )*
+}
+
+void SourceSelector() :
+{}
+{
+ // Must be quoted, must be a URL - no qnames at this point.
+ URL()
+}
+
+void TriplePatternClause() :
+{}
+{
+ <WHERE> TriplePattern() ( CommaOpt() TriplePattern() )*
+}
+
+void ConstraintClause() :
+{}
+{
+ // This comma is not optional - must have comma or "AND"
+ <SUCHTHAT> Expression() ( (<COMMA> | <SUCHTHAT> ) Expression() )*
+}
+
+void TriplePattern() :
+{}
+{
+ <LPAREN> VarOrURI() CommaOpt() VarOrURI() CommaOpt() VarOrLiteral() <RPAREN>
+}
+
+void VarOrURI() #void :
+{}
+{
+ Var() | URI()
+}
+
+void VarOrLiteral() #void :
+{}
+{
+ Var() | Literal()
+}
+
+
+void Var() :
+{ Token t ;}
+{
+ t = <VAR>
+ { jjtThis.setName(t.image) ; }
+// OLD
+// "?" Identifier()
+}
+
+
+void PrefixesClause() :
+{ }
+{
+ // Broken: comma should be optional here. But ... it isn't in practice.
+ // PrefixDecl starts with an IDENITIFER, read in READ_IDENTIFER
+ // token context but CommaOpt may swallow a comma in DEFAULT tokenizing mode
+ // Generated parser seems not to work.
+
+ <PREFIXES> PrefixDecl() ( CommaOpt() PrefixDecl() )*
+}
+
+void PrefixDecl() :
+{}
+{
+ Identifier() <FOR> QuotedURI()
+}
+
+
+/******************************************************************/
+// Constraint syntax follows.
+
+// **** Debug point
+
+void Expression() #void :
+{}
+{
+ ConditionalOrExpression()
+}
+
+void ConditionalOrExpression() #void :
+{}
+{
+ ConditionalXorExpression()
+ ( <SC_OR> ConditionalXorExpression() #LogicalOr(2) )*
+}
+
+void ConditionalXorExpression() #void :
+{}
+{
+ ConditionalAndExpression()
+ // Skip this
+ //( <SC_XOR> ConditionalAndExpression() #LogicalXor(2) )*
+}
+
+void ConditionalAndExpression() #void :
+{}
+{
+ ValueLogical()
+ ( <SC_AND> ValueLogical() #LogicalAnd(2) )*
+}
+
+
+// End of boolean expressions
+
+/******************************************************************/
+
+// Things that are not operations on boolean terms.
+
+void ValueLogical() #void :
+{}
+{
+ StringEqualityExpression()
+}
+
+void StringEqualityExpression() #void :
+{}
+{
+ NumericalLogical()
+ ( <STR_EQ> NumericalLogical() #StringEqual(2)
+ | <STR_NE> NumericalLogical() #StringNotEqual(2)
+ | <STR_LANGEQ> TextLiteral2() #StringLangEqual(2)
+ | <STR_MATCH> PatternLiteral() #StringMatch(2)
+ | <STR_NMATCH> PatternLiteral() #StringNoMatch(2)
+ )*
+}
+
+// Expressions that involve comparing numbers.
+
+void NumericalLogical() #void :
+{}
+{
+ InclusiveOrExpression()
+}
+
+void InclusiveOrExpression() #void :
+{}
+{
+ ExclusiveOrExpression()
+ ( <BIT_OR> ExclusiveOrExpression() #BitOr(2) )*
+}
+
+void ExclusiveOrExpression() #void :
+{}
+{
+ AndExpression()
+ ( <BIT_XOR> AndExpression() #BitXor(2) )*
+}
+
+void AndExpression() #void :
+{}
+{
+ ArithmeticCondition()
+ ( <BIT_AND> ArithmeticCondition() #BitAnd(2) )*
+}
+
+void ArithmeticCondition() #void :
+{}
+{
+ EqualityExpression()
+}
+
+void EqualityExpression() #void :
+{}
+{
+ RelationalExpression()
+ ( <EQ> RelationalExpression() #Equal(2)
+ | <NEQ> RelationalExpression() #NotEqual(2)
+ )?
+}
+
+void RelationalExpression() #void :
+{}
+{
+ NumericExpression()
+ ( <LT> NumericExpression() #LessThan(2)
+ | <GT> NumericExpression() #GreaterThan(2)
+ | <LE> NumericExpression() #LessThanOrEqual(2)
+ | <GE> NumericExpression() #GreaterThanOrEqual(2)
+ )?
+}
+
+/******************************************************************/
+
+// **** Debug point
+
+void NumericExpression () #void :
+{}
+{
+ ShiftExpression()
+}
+
+
+void ShiftExpression() #void :
+{}
+{
+ AdditiveExpression()
+ ( <LSHIFT> AdditiveExpression() #LeftShift(2)
+ | <RSIGNEDSHIFT> AdditiveExpression() #RightSignedShift(2)
+ | <RUNSIGNEDSHIFT> AdditiveExpression() #RightUnsignedShift(2)
+ )*
+}
+
+void AdditiveExpression() #void :
+{}
+{
+ MultiplicativeExpression()
+ ( <PLUS> MultiplicativeExpression() #Add(2)
+ | <MINUS> MultiplicativeExpression() #Subtract(2)
+ )*
+}
+
+void MultiplicativeExpression() #void :
+{}
+{
+ UnaryExpression()
+ ( <STAR> UnaryExpression() #Multiply(2)
+ | <SLASH> UnaryExpression() #Divide(2)
+ | <REM> UnaryExpression() #Modulus(2)
+ )*
+}
+
+void UnaryExpression() #void :
+{}
+{
+ UnaryExpressionNotPlusMinus()
+|
+ ( <PLUS> UnaryExpression() #UnaryPlus(1)
+ | <MINUS> UnaryExpression() #UnaryMinus(1)
+ )
+}
+
+void UnaryExpressionNotPlusMinus() #void :
+{}
+{
+ ( <TILDE> | <BANG> ) UnaryExpression() #UnaryNot(1)
+|
+ PrimaryExpression()
+}
+
+void PrimaryExpression() #void :
+{}
+{
+ Var()
+|
+ Literal()
+|
+ FunctionCall()
+|
+ // And this is why expressions are not typed by the parser!
+ // Arbitrary lookahead of chars to see is the expression
+ // is numeric or boolean.
+ <LPAREN> Expression() <RPAREN>
+}
+
+void FunctionCall() :
+{}
+{
+ "&" Identifier() <LPAREN> ArgList() <RPAREN>
+}
+
+void ArgList() :
+{}
+{
+ VarOrLiteral() (<COMMA> VarOrLiteral() ) *
+}
+
+
+/******************************************************************/
+// Literals (as in query literls - any value in the query
+// Not "RDF literals".
+
+void Literal() #void :
+{}
+{
+ URI()
+|
+ NumericLiteral()
+|
+ TextLiteral()
+|
+ BooleanLiteral()
+|
+ NullLiteral()
+}
+
+void NumericLiteral() :
+{
+ Token t;
+}
+{
+ t = <INTEGER_LITERAL> { jjtThis.set(true, t.image) ; }
+|
+ t = <FLOATING_POINT_LITERAL> { jjtThis.set(false, t.image) ; }
+}
+
+void TextLiteral() :
+{
+ Token t ;
+}
+{
+ ( t = <STRING_LITERAL1> { jjtThis.set(t.image) ; }
+ | t = <STRING_LITERAL2> { jjtThis.set(t.image) ; } )
+
+ // Optional lang tag and datatype.
+
+ ( <AT> Identifier() ) ?
+ ( <DATATYPE> URI() )?
+}
+
+void TextLiteral2() :
+{
+ Token t ;
+}
+{
+ ( t = <STRING_LITERAL1> { jjtThis.set(t.image) ; }
+ | t = <STRING_LITERAL2> { jjtThis.set(t.image) ; } )
+}
+
+<READ_REGEX> TOKEN :
+{
+ // This just creates a token symbol to read a character- we fill it in Java below.
+ // Doing it like this means we use the parser token routines, not the tokenizer directly.
+ <PATTERN: ~[]>
+}
+//<READ_REGEX> SKIP : { " " | "\t" | "\n" | "\r" | "\f" }
+
+
+void PatternLiteral() :
+{
+ Token t ;
+ Token mtoken ;
+ char marker ;
+ int state = 0 ;
+}
+{
+ // Skip whitespace
+
+ {
+ state = token_source.curLexState ;
+ token_source.SwitchTo(READ_REGEX) ;
+ }
+
+ // Pattern language is: [m]/pattern/[i][m][s][x]
+ // Note the leading "m" is optional because // is
+ // often in conflict with URIs so the convenience
+ // of, say "!", as a leading marker is good.
+ // We do check that the RE isn't "....", i.e. markers, with
+ // no "m", that might be a plain string.
+
+ // Having a variable marker is tricky because we can't
+ // define the pattern in fixed tokens. But the target is simple
+ // so we just do it in java.
+ // Skip to marker char (processing escapes)
+
+ {
+ while(true)
+ {
+ t = getNextToken() ;
+ if ( t.kind == EOF )
+ throw new Error("End of file: expecting the start of a regular expression") ;
+ marker = t.image.charAt(0) ;
+ // Skip whitespace
+ if ( marker != ' ' && marker != '\n' &&
+ marker != '\t' && marker != '\r' &&
+ marker != '\f' )
+ break ;
+ }
+ if ( marker != '/' )
+ {
+ if ( marker == 'm' )
+ {
+ //marker = jj_input_stream.readChar() ;
+ t = getNextToken() ;
+ marker = t.image.charAt(0) ;
+ }
+ else
+ {
+ if ( marker == '"' || marker == '\'' )
+ // Does not start m, and does start with " or '
+ throw new Error("Invalid regular expression (starts with ["+marker+"]) at line " +
+ t.beginLine + " column " + t.beginColumn + ".");
+ }
+ // Sanity check - delimiter isn't an alphanumeric
+ if ( Character.isLetterOrDigit(marker) )
+ throw new Error("Invalid start to regular expression at line " +
+ t.beginLine + " column " + t.beginColumn + ".");
+ }
+ String patternString = "" ;
+ boolean inEscape = false ;
+ while(true)
+ {
+ char ch ;
+ t = getNextToken() ;
+ if ( t.kind == EOF )
+ throw new Error("End of file during regular expression") ;
+ ch = t.image.charAt(0) ;
+
+ if ( ch == '\n' || ch == '\r' || ch == '\f' )
+ throw new Error("Invalid regular expression at line " +
+ t.beginLine + " column " + t.beginColumn + ".");
+ if ( inEscape )
+ {
+ if ( ch == 'n' ) ch = '\n' ;
+ if ( ch == 't' ) ch = '\t' ;
+ if ( ch == 'r' ) ch = '\r' ;
+ if ( ch == 'b' ) ch = '\b' ;
+
+ // But if we are escaping a character that is regex significant,
+ // leave in the esacape.
+ if ( ch != marker )
+ patternString = patternString + '\\' ;
+
+ inEscape = false ;
+ }
+ else
+ {
+ // Escape?
+ if ( ch == '\\' )
+ {
+ inEscape = true ;
+ continue ;
+ }
+ if ( ch == marker )
+ break ;
+
+ }
+ patternString = patternString + ch ;
+ }
+ // Read modifiers
+ String modifiers = "" ;
+ while(true)
+ {
+ char ch ;
+ // End of file possible.
+ t = getNextToken() ;
+ if ( t.kind == EOF )
+ break ;
+ ch = t.image.charAt(0) ;
+
+ if ( ch == 'i' || ch == 'm' || ch == 's' || ch == 'x' )
+ modifiers = modifiers + ch ;
+ else
+ {
+ jj_input_stream.backup(1) ;
+ break ;
+ }
+ }
+
+ token_source.SwitchTo(state) ;
+ jjtThis.setPattern(patternString) ;
+ if ( modifiers.length() > 0 )
+ jjtThis.setModifiers(modifiers) ;
+ }
+}
+
+
+void BooleanLiteral() :
+{
+ Token t ;
+}
+{
+ t = <BOOLEAN_LITERAL> { jjtThis.set(t.image) ; }
+}
+
+void NullLiteral() :
+{}
+{
+ <NULL_LITERAL>
+}
+
+void URL() :
+{}
+{
+ QuotedURI()
+}
+
+void URI() #void :
+{ }
+{
+ QuotedURI()
+|
+ QName()
+}
+
+void QName() :
+{ Token t1, t2 ; }
+{
+ //<Prefix> ":" (<LocalPart>) { jjtThis.set(token.image) ; }
+ Identifier()
+ { t1 = token ; }
+ ":" (LOOKAHEAD(2) Identifier())?
+ { t2 = token ;
+ jjtThis.set(t1.image+":"+t2.image) ; }
+}
+
+// Should move this into tokens section
+// as part of getting the ordering right.
+
+void QuotedURI() :
+{ Token tt = null ;
+ int state = 0 ;
+}
+{
+ "<"
+ {
+ state = token_source.curLexState ;
+ token_source.SwitchTo(READ_URI) ;
+ }
+ tt = <URI>
+ {
+ jjtThis.set(tt.image) ;
+ token_source.SwitchTo(state) ;
+ }
+ ">"
+}
+
+
+
+// Need to generalise this to include leading digits
+// That is, the second part of an NCName expressions
+
+void Identifier() :
+{}
+{
+ ( //<IDENTIFIER>
+ <NCName>
+ // And all keywords
+ | <SELECT> | <SOURCE> | <FROM> | <WHERE>
+ | <SUCHTHAT> | <PREFIXES> | <FOR>
+ | <STR_EQ> | <STR_NE> )
+ { jjtThis.set(token.image) ; }
+}
+
+
+/*
+ * (c) Copyright 2001, 2002, 2003, 2004, 2005 Hewlett-Packard Development Company, LP
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. 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.
+ * 3. The name of the author may not be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 THE AUTHOR 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.
+ */
+
+/*
+# Local Variables:
+# tab-width: 4
+# indent-tabs-mode: nil
+# comment-default-style: "//"
+# End:
+*/
Added: incubator/jena/Jena2/ARQ/trunk/Grammar/json
URL: http://svn.apache.org/viewvc/incubator/jena/Jena2/ARQ/trunk/Grammar/json?rev=1162982&view=auto
==============================================================================
--- incubator/jena/Jena2/ARQ/trunk/Grammar/json (added)
+++ incubator/jena/Jena2/ARQ/trunk/Grammar/json Mon Aug 29 20:24:55 2011
@@ -0,0 +1,103 @@
+#!/bin/bash
+# Parser builder
+
+GRAMMAR="${GRAMMAR:-"json.jj"}"
+ROOT=".."
+PKG=org/openjena/atlas/json/io/parserjavacc/javacc
+
+# --------------------------------------------------------
+
+function grammar
+{
+ local FILE="$1"
+ local PKG="$2"
+ local CLASS="$3"
+ echo "JavaCC: $1 $2 $3"
+
+ DIR="$ROOT/src/$PKG"
+ ( cd $DIR ; rm -f TokenMgrError.java ParseException.java Token.java JavaCharStream.java SimpleCharStream.java )
+
+ echo "---- Process grammar -- $1"
+ javacc -OUTPUT_DIRECTORY=$DIR -JDK_VERSION=1.5 "${FILE}"
+ RC=$?
+
+ [ "$RC" = 0 ] || return $RC
+
+## echo "---- Create HTML"
+## jjdoc -OUTPUT_FILE=${FILE%%.jj}.html "${FILE}"
+## echo "---- Create text form"
+## jjdoc -TEXT=true -OUTPUT_FILE=${FILE%%.jj}.txt "${FILE}"
+
+ # Fix unnecessary imports
+ echo "---- Fixing Java warnings in ${CLASS}TokenManager ..."
+ F="$DIR/${CLASS}TokenManager.java"
+ sed -e 's/import .*//' -e 's/MatchLoop: do/do/' \
+ -e 's/int hiByte = (int)(curChar/int hiByte = (curChar/' \
+ < $F > F
+ mv F $F
+
+## echo "---- Fixing Java warnings in JavaCharStream ..."
+## F="$DIR/JavaCharStream.java"
+## if [ -e "$F" ]
+## then
+## sed -e 's/@Deprecated //' \
+## -e 's/public int getColumn/@Deprecated public int getColumn/' \
+## -e 's/public int getLine/@Deprecated public int getLine/' < $F > F
+## mv F $F
+## fi
+
+ echo "---- Fixing Java warnings in ParseException ..."
+ #Override:
+ # public String getMessage()
+ F="$DIR/ParseException.java"
+ sed -e 's/@Override //' \
+ -e 's/public String getMessage/@Override public String getMessage/' < $F > F
+ mv F $F
+
+ echo "---- Fixing Java warnings in Token ..."
+ F="$DIR/Token.java"
+ sed -e 's/@Override //' \
+ -e 's/public String toString/@Override public String toString/' < $F > F
+ mv F $F
+
+ echo "---- Fixing Java warnings in TokenMgrError ..."
+ # Override:
+ # public String getMessage()
+ F="$DIR/TokenMgrError.java"
+ sed -e 's/@Override //' \
+ -e 's/public String getMessage/@Override public String getMessage/' < $F > F
+ mv F $F
+
+## echo "---- Fixing Java warnings in ${CLASS} ..."
+## F="$DIR/${CLASS}.java"
+## cat $F > F
+## mv F $F
+ echo "---- Done"
+}
+
+## if [ $# == 0 ]
+## then
+## set -- json
+## ## echo "Usage: grammar [json]" 1>&2
+## ## exit 1
+## fi
+
+if [ $# == 0 ]
+then
+ set -- json
+ fi
+
+
+for G in "$@"
+ do
+ case "$G" in
+ json)
+ dos2unix < "$GRAMMAR" | cpp -P -C | unix2dos > parser.jj
+ grammar parser.jj $PKG JSON_Parser
+ #grammar json.jj atlas/json/io/parserjavacc/javacc JSON_Parser
+ [ "$RC" = 0 ] && rm -f parser.jj
+ ;;
+ *) echo "**** Unknown grammar: $G" 1>&2
+ ;;
+ esac
+done
Propchange: incubator/jena/Jena2/ARQ/trunk/Grammar/json
------------------------------------------------------------------------------
svn:executable = *
Added: incubator/jena/Jena2/ARQ/trunk/Grammar/json.jj
URL: http://svn.apache.org/viewvc/incubator/jena/Jena2/ARQ/trunk/Grammar/json.jj?rev=1162982&view=auto
==============================================================================
--- incubator/jena/Jena2/ARQ/trunk/Grammar/json.jj (added)
+++ incubator/jena/Jena2/ARQ/trunk/Grammar/json.jj Mon Aug 29 20:24:55 2011
@@ -0,0 +1,272 @@
+#if 0
+// (Run through cpp -P -C first)
+#endif
+
+#define PACKAGE org.openjena.atlas.json.io.parserjavacc.javacc
+#define CLASS JSON_Parser
+#define PARSERBASE JSON_ParserBase
+
+options
+{
+ JAVA_UNICODE_ESCAPE = true ;
+ UNICODE_INPUT = false ;
+
+ STATIC = false ;
+// DEBUG_PARSER = true ;
+// DEBUG_TOKEN_MANAGER = true ;
+}
+
+
+PARSER_BEGIN(CLASS)
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package PACKAGE ;
+
+public class CLASS extends PARSERBASE
+{
+}
+PARSER_END(CLASS)
+
+
+SKIP : { <" " | "\t" | "\n" | "\r" | "\f"> }
+TOKEN: { <WS: " " | "\t" | "\n" | "\r" | "\f"> }
+
+// Do \ u inside JavaCC??
+
+//TOKEN [IGNORE_CASE] :
+TOKEN :
+{
+ <ECHAR: "\\" ( "t"|"b"|"n"|"r"|"f"|"\\"|"\""|"'") >
+| < #QUOTE_3D: "\"\"\"">
+| < #QUOTE_3S: "'''">
+| < STRING_LITERAL1:
+ // Single quoted string
+ "'" ( (~["'","\\","\n","\r"]) | <ECHAR> )* "'" >
+| < STRING_LITERAL2:
+ // Double quoted string
+ "\"" ( (~["\"","\\","\n","\r"]) | <ECHAR> )* "\"" >
+| < STRING_LITERAL_LONG1:
+ <QUOTE_3S>
+ ( ("'" | "''")? (~["'","\\"] | <ECHAR> ))*
+ <QUOTE_3S> >
+
+| < STRING_LITERAL_LONG2:
+ <QUOTE_3D>
+ ( ("\"" | "\"\"")? (~["\"","\\"] | <ECHAR> ))*
+ <QUOTE_3D> >
+
+
+
+
+| < #DIGITS: (["0"-"9"])+>
+| < INTEGER: <DIGITS> >
+| < DECIMAL: ( <DIGITS> "." (<DIGITS>)* | "." <DIGITS> ) >
+| < DOUBLE: // Required exponent.
+ (
+ (["0"-"9"])+ "." (["0"-"9"])* <EXPONENT>
+ | "." (["0"-"9"])+ (<EXPONENT>)
+ | (["0"-"9"])+ <EXPONENT>
+ )
+ >
+
+| < POSITIVE_INTEGER: <PLUS> <INTEGER> >
+| < POSITIVE_DECIMAL: <PLUS> <DECIMAL> >
+| < POSITIVE_DOUBLE: <PLUS> <DOUBLE> >
+
+| < NEGATIVE_INTEGER: <MINUS> <INTEGER> >
+| < NEGATIVE_DECIMAL: <MINUS> <DECIMAL> >
+| < NEGATIVE_DOUBLE: <MINUS> <DOUBLE> >
+
+| < #EXPONENT: ["e","E"] (["+","-"])? (["0"-"9"])+ >
+
+
+| <TRUE: "true">
+| <FALSE: "false">
+| <NULL: "null">
+
+| < LBRACE: "{" >
+| < RBRACE: "}" >
+
+| < LBRACKET: "[" >
+| < RBRACKET: "]" >
+
+| < LPAREN: "(" >
+| < RPAREN: ")" >
+
+| <COMMA: "," >
+| <COLON: ":" >
+
+| <PLUS: "+" >
+| <MINUS: "-" >
+}
+
+// ---- Parser entry points
+
+void unit() : {}
+{
+ { startParse() ; }
+ object()
+ { finishParse() ; }
+ <EOF>
+}
+
+
+void any() : {}
+{
+ { startParse() ; }
+ (Value())?
+ { finishParse() ; }
+ <EOF>
+}
+
+
+// ---- Structures
+
+void Value() : {}
+{
+ SimpleValue()
+| object()
+| Array()
+}
+
+void object() : { }
+{
+ <LBRACE>
+ { startObject() ; }
+ (Members())?
+ { finishObject(); }
+ <RBRACE>
+}
+
+void Members() : {}
+{
+ Pair()
+ (<COMMA> Pair())*
+}
+
+void Pair() : {}
+{
+ { startPair() ; }
+ String()
+ { keyPair() ; }
+ <COLON>
+ Value()
+ { finishPair() ; }
+}
+
+void Array() : {}
+{
+ <LBRACKET>
+ { startArray() ; }
+ (Elements())?
+ { finishArray() ; }
+ <RBRACKET>
+}
+
+void Elements() : { }
+{
+ ArrayValue()
+ (<COMMA> ArrayValue())*
+}
+
+void ArrayValue() : { }
+{
+ Value() { element() ; }
+}
+
+// ----
+
+void SimpleValue() : {}
+{
+ String()
+| Number()
+| True()
+| False()
+| Null()
+}
+
+void Number() : { Token t ; }
+{
+ t = <INTEGER> { valueInteger(t.image) ; }
+| t = <DECIMAL> { valueDecimal(t.image) ; }
+| t = <DOUBLE> { valueDouble(t.image) ; }
+| t = <POSITIVE_INTEGER> { valueInteger(t.image) ; }
+| t = <POSITIVE_DECIMAL> { valueDecimal(t.image) ; }
+| t = <POSITIVE_DOUBLE> { valueDouble(t.image) ; }
+| t = <NEGATIVE_INTEGER> { valueInteger(t.image) ; }
+| t = <NEGATIVE_DECIMAL> { valueDecimal(t.image) ; }
+| t = <NEGATIVE_DOUBLE> { valueDouble(t.image) ; }
+}
+
+// Token to Java Object : These rules exist to inject the
+// necessary Java objects and code for the tokens.
+void String() : { Token t ; }
+{
+ t = <STRING_LITERAL2> { valueString(t.image); }
+ // <STRING>
+}
+
+void True() : { Token t ; }
+{
+ <TRUE> { valueBoolean(true) ; }
+}
+
+void False() : { Token t ; }
+{
+ <FALSE> { valueBoolean(false) ; }
+}
+
+void Null() : { Token t ; }
+{
+ <NULL> { valueNull() ; }
+}
+
+
+/*
+ * (c) Copyright 2008 Hewlett-Packard Development Company, LP
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. 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.
+ * 3. The name of the author may not be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 THE AUTHOR 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.
+ */
+/*
+# Local Variables:
+# tab-width: 4
+# indent-tabs-mode: nil
+# comment-default-style: "//"
+# End:
+*/
Modified: incubator/jena/Jena2/ARQ/trunk/src/org/openjena/atlas/json/io/parserjavacc/javacc/JSON_Parser.java
URL: http://svn.apache.org/viewvc/incubator/jena/Jena2/ARQ/trunk/src/org/openjena/atlas/json/io/parserjavacc/javacc/JSON_Parser.java?rev=1162982&r1=1162981&r2=1162982&view=diff
==============================================================================
--- incubator/jena/Jena2/ARQ/trunk/src/org/openjena/atlas/json/io/parserjavacc/javacc/JSON_Parser.java (original)
+++ incubator/jena/Jena2/ARQ/trunk/src/org/openjena/atlas/json/io/parserjavacc/javacc/JSON_Parser.java Mon Aug 29 20:24:55 2011
@@ -1,451 +1,462 @@
-/* Generated By:JavaCC: Do not edit this line. JSON_Parser.java */
-/*
- * (c) Copyright 2008 Hewlett-Packard Development Company, LP
- * All rights reserved.
- */
-
-package org.openjena.atlas.json.io.parserjavacc.javacc ;
-
-public class JSON_Parser extends JSON_ParserBase implements JSON_ParserConstants {
-
+/* Generated By:JavaCC: Do not edit this line. JSON_Parser.java */
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.openjena.atlas.json.io.parserjavacc.javacc ;
+public class JSON_Parser extends JSON_ParserBase implements JSON_ParserConstants {
+
// ---- Parser entry points
- final public void unit() throws ParseException {
- startParse() ;
- object();
- finishParse() ;
- jj_consume_token(0);
- }
-
- final public void any() throws ParseException {
- startParse() ;
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case STRING_LITERAL2:
- case INTEGER:
- case DECIMAL:
- case DOUBLE:
- case POSITIVE_INTEGER:
- case POSITIVE_DECIMAL:
- case POSITIVE_DOUBLE:
- case NEGATIVE_INTEGER:
- case NEGATIVE_DECIMAL:
- case NEGATIVE_DOUBLE:
- case TRUE:
- case FALSE:
- case NULL:
- case LBRACE:
- case LBRACKET:
- Value();
- break;
- default:
- jj_la1[0] = jj_gen;
- ;
- }
- finishParse() ;
- jj_consume_token(0);
- }
-
+ final public void unit() throws ParseException {
+ startParse() ;
+ object();
+ finishParse() ;
+ jj_consume_token(0);
+ }
+
+ final public void any() throws ParseException {
+ startParse() ;
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case STRING_LITERAL2:
+ case INTEGER:
+ case DECIMAL:
+ case DOUBLE:
+ case POSITIVE_INTEGER:
+ case POSITIVE_DECIMAL:
+ case POSITIVE_DOUBLE:
+ case NEGATIVE_INTEGER:
+ case NEGATIVE_DECIMAL:
+ case NEGATIVE_DOUBLE:
+ case TRUE:
+ case FALSE:
+ case NULL:
+ case LBRACE:
+ case LBRACKET:
+ Value();
+ break;
+ default:
+ jj_la1[0] = jj_gen;
+ ;
+ }
+ finishParse() ;
+ jj_consume_token(0);
+ }
+
// ---- Structures
- final public void Value() throws ParseException {
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case STRING_LITERAL2:
- case INTEGER:
- case DECIMAL:
- case DOUBLE:
- case POSITIVE_INTEGER:
- case POSITIVE_DECIMAL:
- case POSITIVE_DOUBLE:
- case NEGATIVE_INTEGER:
- case NEGATIVE_DECIMAL:
- case NEGATIVE_DOUBLE:
- case TRUE:
- case FALSE:
- case NULL:
- SimpleValue();
- break;
- case LBRACE:
- object();
- break;
- case LBRACKET:
- Array();
- break;
- default:
- jj_la1[1] = jj_gen;
- jj_consume_token(-1);
- throw new ParseException();
- }
- }
-
- final public void object() throws ParseException {
- jj_consume_token(LBRACE);
- startObject() ;
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case STRING_LITERAL2:
- Members();
- break;
- default:
- jj_la1[2] = jj_gen;
- ;
- }
- finishObject();
- jj_consume_token(RBRACE);
- }
-
- final public void Members() throws ParseException {
- Pair();
- label_1:
- while (true) {
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case COMMA:
- ;
- break;
- default:
- jj_la1[3] = jj_gen;
- break label_1;
- }
- jj_consume_token(COMMA);
- Pair();
- }
- }
-
- final public void Pair() throws ParseException {
- startPair() ;
- String();
- keyPair() ;
- jj_consume_token(COLON);
- Value();
- finishPair() ;
- }
-
- final public void Array() throws ParseException {
- jj_consume_token(LBRACKET);
- startArray() ;
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case STRING_LITERAL2:
- case INTEGER:
- case DECIMAL:
- case DOUBLE:
- case POSITIVE_INTEGER:
- case POSITIVE_DECIMAL:
- case POSITIVE_DOUBLE:
- case NEGATIVE_INTEGER:
- case NEGATIVE_DECIMAL:
- case NEGATIVE_DOUBLE:
- case TRUE:
- case FALSE:
- case NULL:
- case LBRACE:
- case LBRACKET:
- Elements();
- break;
- default:
- jj_la1[4] = jj_gen;
- ;
- }
- finishArray() ;
- jj_consume_token(RBRACKET);
- }
-
- final public void Elements() throws ParseException {
- ArrayValue();
- label_2:
- while (true) {
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case COMMA:
- ;
- break;
- default:
- jj_la1[5] = jj_gen;
- break label_2;
- }
- jj_consume_token(COMMA);
- ArrayValue();
- }
- }
-
- final public void ArrayValue() throws ParseException {
- Value();
- element() ;
- }
-
+ final public void Value() throws ParseException {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case STRING_LITERAL2:
+ case INTEGER:
+ case DECIMAL:
+ case DOUBLE:
+ case POSITIVE_INTEGER:
+ case POSITIVE_DECIMAL:
+ case POSITIVE_DOUBLE:
+ case NEGATIVE_INTEGER:
+ case NEGATIVE_DECIMAL:
+ case NEGATIVE_DOUBLE:
+ case TRUE:
+ case FALSE:
+ case NULL:
+ SimpleValue();
+ break;
+ case LBRACE:
+ object();
+ break;
+ case LBRACKET:
+ Array();
+ break;
+ default:
+ jj_la1[1] = jj_gen;
+ jj_consume_token(-1);
+ throw new ParseException();
+ }
+ }
+
+ final public void object() throws ParseException {
+ jj_consume_token(LBRACE);
+ startObject() ;
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case STRING_LITERAL2:
+ Members();
+ break;
+ default:
+ jj_la1[2] = jj_gen;
+ ;
+ }
+ finishObject();
+ jj_consume_token(RBRACE);
+ }
+
+ final public void Members() throws ParseException {
+ Pair();
+ label_1:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case COMMA:
+ ;
+ break;
+ default:
+ jj_la1[3] = jj_gen;
+ break label_1;
+ }
+ jj_consume_token(COMMA);
+ Pair();
+ }
+ }
+
+ final public void Pair() throws ParseException {
+ startPair() ;
+ String();
+ keyPair() ;
+ jj_consume_token(COLON);
+ Value();
+ finishPair() ;
+ }
+
+ final public void Array() throws ParseException {
+ jj_consume_token(LBRACKET);
+ startArray() ;
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case STRING_LITERAL2:
+ case INTEGER:
+ case DECIMAL:
+ case DOUBLE:
+ case POSITIVE_INTEGER:
+ case POSITIVE_DECIMAL:
+ case POSITIVE_DOUBLE:
+ case NEGATIVE_INTEGER:
+ case NEGATIVE_DECIMAL:
+ case NEGATIVE_DOUBLE:
+ case TRUE:
+ case FALSE:
+ case NULL:
+ case LBRACE:
+ case LBRACKET:
+ Elements();
+ break;
+ default:
+ jj_la1[4] = jj_gen;
+ ;
+ }
+ finishArray() ;
+ jj_consume_token(RBRACKET);
+ }
+
+ final public void Elements() throws ParseException {
+ ArrayValue();
+ label_2:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case COMMA:
+ ;
+ break;
+ default:
+ jj_la1[5] = jj_gen;
+ break label_2;
+ }
+ jj_consume_token(COMMA);
+ ArrayValue();
+ }
+ }
+
+ final public void ArrayValue() throws ParseException {
+ Value();
+ element() ;
+ }
+
// ----
- final public void SimpleValue() throws ParseException {
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case STRING_LITERAL2:
- String();
- break;
- case INTEGER:
- case DECIMAL:
- case DOUBLE:
- case POSITIVE_INTEGER:
- case POSITIVE_DECIMAL:
- case POSITIVE_DOUBLE:
- case NEGATIVE_INTEGER:
- case NEGATIVE_DECIMAL:
- case NEGATIVE_DOUBLE:
- Number();
- break;
- case TRUE:
- True();
- break;
- case FALSE:
- False();
- break;
- case NULL:
- Null();
- break;
- default:
- jj_la1[6] = jj_gen;
- jj_consume_token(-1);
- throw new ParseException();
- }
- }
-
- final public void Number() throws ParseException {
- Token t ;
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case INTEGER:
- t = jj_consume_token(INTEGER);
- valueInteger(t.image) ;
- break;
- case DECIMAL:
- t = jj_consume_token(DECIMAL);
- valueDecimal(t.image) ;
- break;
- case DOUBLE:
- t = jj_consume_token(DOUBLE);
- valueDouble(t.image) ;
- break;
- case POSITIVE_INTEGER:
- t = jj_consume_token(POSITIVE_INTEGER);
- valueInteger(t.image) ;
- break;
- case POSITIVE_DECIMAL:
- t = jj_consume_token(POSITIVE_DECIMAL);
- valueDecimal(t.image) ;
- break;
- case POSITIVE_DOUBLE:
- t = jj_consume_token(POSITIVE_DOUBLE);
- valueDouble(t.image) ;
- break;
- case NEGATIVE_INTEGER:
- t = jj_consume_token(NEGATIVE_INTEGER);
- valueInteger(t.image) ;
- break;
- case NEGATIVE_DECIMAL:
- t = jj_consume_token(NEGATIVE_DECIMAL);
- valueDecimal(t.image) ;
- break;
- case NEGATIVE_DOUBLE:
- t = jj_consume_token(NEGATIVE_DOUBLE);
- valueDouble(t.image) ;
- break;
- default:
- jj_la1[7] = jj_gen;
- jj_consume_token(-1);
- throw new ParseException();
- }
- }
-
+ final public void SimpleValue() throws ParseException {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case STRING_LITERAL2:
+ String();
+ break;
+ case INTEGER:
+ case DECIMAL:
+ case DOUBLE:
+ case POSITIVE_INTEGER:
+ case POSITIVE_DECIMAL:
+ case POSITIVE_DOUBLE:
+ case NEGATIVE_INTEGER:
+ case NEGATIVE_DECIMAL:
+ case NEGATIVE_DOUBLE:
+ Number();
+ break;
+ case TRUE:
+ True();
+ break;
+ case FALSE:
+ False();
+ break;
+ case NULL:
+ Null();
+ break;
+ default:
+ jj_la1[6] = jj_gen;
+ jj_consume_token(-1);
+ throw new ParseException();
+ }
+ }
+
+ final public void Number() throws ParseException {
+ Token t ;
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case INTEGER:
+ t = jj_consume_token(INTEGER);
+ valueInteger(t.image) ;
+ break;
+ case DECIMAL:
+ t = jj_consume_token(DECIMAL);
+ valueDecimal(t.image) ;
+ break;
+ case DOUBLE:
+ t = jj_consume_token(DOUBLE);
+ valueDouble(t.image) ;
+ break;
+ case POSITIVE_INTEGER:
+ t = jj_consume_token(POSITIVE_INTEGER);
+ valueInteger(t.image) ;
+ break;
+ case POSITIVE_DECIMAL:
+ t = jj_consume_token(POSITIVE_DECIMAL);
+ valueDecimal(t.image) ;
+ break;
+ case POSITIVE_DOUBLE:
+ t = jj_consume_token(POSITIVE_DOUBLE);
+ valueDouble(t.image) ;
+ break;
+ case NEGATIVE_INTEGER:
+ t = jj_consume_token(NEGATIVE_INTEGER);
+ valueInteger(t.image) ;
+ break;
+ case NEGATIVE_DECIMAL:
+ t = jj_consume_token(NEGATIVE_DECIMAL);
+ valueDecimal(t.image) ;
+ break;
+ case NEGATIVE_DOUBLE:
+ t = jj_consume_token(NEGATIVE_DOUBLE);
+ valueDouble(t.image) ;
+ break;
+ default:
+ jj_la1[7] = jj_gen;
+ jj_consume_token(-1);
+ throw new ParseException();
+ }
+ }
+
// Token to Java Object : These rules exist to inject the
// necessary Java objects and code for the tokens.
- final public void String() throws ParseException {
- Token t ;
- t = jj_consume_token(STRING_LITERAL2);
- valueString(t.image);
- }
-
- final public void True() throws ParseException {
- Token t ;
- jj_consume_token(TRUE);
- valueBoolean(true) ;
- }
-
- final public void False() throws ParseException {
- Token t ;
- jj_consume_token(FALSE);
- valueBoolean(false) ;
- }
-
- final public void Null() throws ParseException {
- Token t ;
- jj_consume_token(NULL);
- valueNull() ;
- }
-
- /** Generated Token Manager. */
- public JSON_ParserTokenManager token_source;
- JavaCharStream jj_input_stream;
- /** Current token. */
- public Token token;
- /** Next token. */
- public Token jj_nt;
- private int jj_ntk;
- private int jj_gen;
- final private int[] jj_la1 = new int[8];
- static private int[] jj_la1_0;
- static private int[] jj_la1_1;
- static {
- jj_la1_init_0();
- jj_la1_init_1();
- }
- private static void jj_la1_init_0() {
- jj_la1_0 = new int[] {0x5eff880,0x5eff880,0x80,0x40000000,0x5eff880,0x40000000,0xeff880,0xff800,};
- }
- private static void jj_la1_init_1() {
- jj_la1_1 = new int[] {0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,};
- }
-
- /** Constructor with InputStream. */
- public JSON_Parser(java.io.InputStream stream) {
- this(stream, null);
- }
- /** Constructor with InputStream and supplied encoding */
- public JSON_Parser(java.io.InputStream stream, String encoding) {
- try { jj_input_stream = new JavaCharStream(stream, encoding, 1, 1); } catch(java.io.UnsupportedEncodingException e) { throw new RuntimeException(e); }
- token_source = new JSON_ParserTokenManager(jj_input_stream);
- token = new Token();
- jj_ntk = -1;
- jj_gen = 0;
- for (int i = 0; i < 8; i++) jj_la1[i] = -1;
- }
-
- /** Reinitialise. */
- public void ReInit(java.io.InputStream stream) {
- ReInit(stream, null);
- }
- /** Reinitialise. */
- public void ReInit(java.io.InputStream stream, String encoding) {
- try { jj_input_stream.ReInit(stream, encoding, 1, 1); } catch(java.io.UnsupportedEncodingException e) { throw new RuntimeException(e); }
- token_source.ReInit(jj_input_stream);
- token = new Token();
- jj_ntk = -1;
- jj_gen = 0;
- for (int i = 0; i < 8; i++) jj_la1[i] = -1;
- }
-
- /** Constructor. */
- public JSON_Parser(java.io.Reader stream) {
- jj_input_stream = new JavaCharStream(stream, 1, 1);
- token_source = new JSON_ParserTokenManager(jj_input_stream);
- token = new Token();
- jj_ntk = -1;
- jj_gen = 0;
- for (int i = 0; i < 8; i++) jj_la1[i] = -1;
- }
-
- /** Reinitialise. */
- public void ReInit(java.io.Reader stream) {
- jj_input_stream.ReInit(stream, 1, 1);
- token_source.ReInit(jj_input_stream);
- token = new Token();
- jj_ntk = -1;
- jj_gen = 0;
- for (int i = 0; i < 8; i++) jj_la1[i] = -1;
- }
-
- /** Constructor with generated Token Manager. */
- public JSON_Parser(JSON_ParserTokenManager tm) {
- token_source = tm;
- token = new Token();
- jj_ntk = -1;
- jj_gen = 0;
- for (int i = 0; i < 8; i++) jj_la1[i] = -1;
- }
-
- /** Reinitialise. */
- public void ReInit(JSON_ParserTokenManager tm) {
- token_source = tm;
- token = new Token();
- jj_ntk = -1;
- jj_gen = 0;
- for (int i = 0; i < 8; i++) jj_la1[i] = -1;
- }
-
- private Token jj_consume_token(int kind) throws ParseException {
- Token oldToken;
- if ((oldToken = token).next != null) token = token.next;
- else token = token.next = token_source.getNextToken();
- jj_ntk = -1;
- if (token.kind == kind) {
- jj_gen++;
- return token;
- }
- token = oldToken;
- jj_kind = kind;
- throw generateParseException();
- }
-
-
-/** Get the next Token. */
- final public Token getNextToken() {
- if (token.next != null) token = token.next;
- else token = token.next = token_source.getNextToken();
- jj_ntk = -1;
- jj_gen++;
- return token;
- }
-
-/** Get the specific Token. */
- final public Token getToken(int index) {
- Token t = token;
- for (int i = 0; i < index; i++) {
- if (t.next != null) t = t.next;
- else t = t.next = token_source.getNextToken();
- }
- return t;
- }
-
- private int jj_ntk() {
- if ((jj_nt=token.next) == null)
- return (jj_ntk = (token.next=token_source.getNextToken()).kind);
- else
- return (jj_ntk = jj_nt.kind);
- }
-
- private java.util.List<int[]> jj_expentries = new java.util.ArrayList<int[]>();
- private int[] jj_expentry;
- private int jj_kind = -1;
-
- /** Generate ParseException. */
- public ParseException generateParseException() {
- jj_expentries.clear();
- boolean[] la1tokens = new boolean[34];
- if (jj_kind >= 0) {
- la1tokens[jj_kind] = true;
- jj_kind = -1;
- }
- for (int i = 0; i < 8; i++) {
- if (jj_la1[i] == jj_gen) {
- for (int j = 0; j < 32; j++) {
- if ((jj_la1_0[i] & (1<<j)) != 0) {
- la1tokens[j] = true;
- }
- if ((jj_la1_1[i] & (1<<j)) != 0) {
- la1tokens[32+j] = true;
- }
- }
- }
- }
- for (int i = 0; i < 34; i++) {
- if (la1tokens[i]) {
- jj_expentry = new int[1];
- jj_expentry[0] = i;
- jj_expentries.add(jj_expentry);
- }
- }
- int[][] exptokseq = new int[jj_expentries.size()][];
- for (int i = 0; i < jj_expentries.size(); i++) {
- exptokseq[i] = jj_expentries.get(i);
- }
- return new ParseException(token, exptokseq, tokenImage);
- }
-
- /** Enable tracing. */
- final public void enable_tracing() {
- }
-
- /** Disable tracing. */
- final public void disable_tracing() {
- }
-
-}
+ final public void String() throws ParseException {
+ Token t ;
+ t = jj_consume_token(STRING_LITERAL2);
+ valueString(t.image);
+ }
+
+ final public void True() throws ParseException {
+ Token t ;
+ jj_consume_token(TRUE);
+ valueBoolean(true) ;
+ }
+
+ final public void False() throws ParseException {
+ Token t ;
+ jj_consume_token(FALSE);
+ valueBoolean(false) ;
+ }
+
+ final public void Null() throws ParseException {
+ Token t ;
+ jj_consume_token(NULL);
+ valueNull() ;
+ }
+
+ /** Generated Token Manager. */
+ public JSON_ParserTokenManager token_source;
+ JavaCharStream jj_input_stream;
+ /** Current token. */
+ public Token token;
+ /** Next token. */
+ public Token jj_nt;
+ private int jj_ntk;
+ private int jj_gen;
+ final private int[] jj_la1 = new int[8];
+ static private int[] jj_la1_0;
+ static private int[] jj_la1_1;
+ static {
+ jj_la1_init_0();
+ jj_la1_init_1();
+ }
+ private static void jj_la1_init_0() {
+ jj_la1_0 = new int[] {0x5eff880,0x5eff880,0x80,0x40000000,0x5eff880,0x40000000,0xeff880,0xff800,};
+ }
+ private static void jj_la1_init_1() {
+ jj_la1_1 = new int[] {0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,};
+ }
+
+ /** Constructor with InputStream. */
+ public JSON_Parser(java.io.InputStream stream) {
+ this(stream, null);
+ }
+ /** Constructor with InputStream and supplied encoding */
+ public JSON_Parser(java.io.InputStream stream, String encoding) {
+ try { jj_input_stream = new JavaCharStream(stream, encoding, 1, 1); } catch(java.io.UnsupportedEncodingException e) { throw new RuntimeException(e); }
+ token_source = new JSON_ParserTokenManager(jj_input_stream);
+ token = new Token();
+ jj_ntk = -1;
+ jj_gen = 0;
+ for (int i = 0; i < 8; i++) jj_la1[i] = -1;
+ }
+
+ /** Reinitialise. */
+ public void ReInit(java.io.InputStream stream) {
+ ReInit(stream, null);
+ }
+ /** Reinitialise. */
+ public void ReInit(java.io.InputStream stream, String encoding) {
+ try { jj_input_stream.ReInit(stream, encoding, 1, 1); } catch(java.io.UnsupportedEncodingException e) { throw new RuntimeException(e); }
+ token_source.ReInit(jj_input_stream);
+ token = new Token();
+ jj_ntk = -1;
+ jj_gen = 0;
+ for (int i = 0; i < 8; i++) jj_la1[i] = -1;
+ }
+
+ /** Constructor. */
+ public JSON_Parser(java.io.Reader stream) {
+ jj_input_stream = new JavaCharStream(stream, 1, 1);
+ token_source = new JSON_ParserTokenManager(jj_input_stream);
+ token = new Token();
+ jj_ntk = -1;
+ jj_gen = 0;
+ for (int i = 0; i < 8; i++) jj_la1[i] = -1;
+ }
+
+ /** Reinitialise. */
+ public void ReInit(java.io.Reader stream) {
+ jj_input_stream.ReInit(stream, 1, 1);
+ token_source.ReInit(jj_input_stream);
+ token = new Token();
+ jj_ntk = -1;
+ jj_gen = 0;
+ for (int i = 0; i < 8; i++) jj_la1[i] = -1;
+ }
+
+ /** Constructor with generated Token Manager. */
+ public JSON_Parser(JSON_ParserTokenManager tm) {
+ token_source = tm;
+ token = new Token();
+ jj_ntk = -1;
+ jj_gen = 0;
+ for (int i = 0; i < 8; i++) jj_la1[i] = -1;
+ }
+
+ /** Reinitialise. */
+ public void ReInit(JSON_ParserTokenManager tm) {
+ token_source = tm;
+ token = new Token();
+ jj_ntk = -1;
+ jj_gen = 0;
+ for (int i = 0; i < 8; i++) jj_la1[i] = -1;
+ }
+
+ private Token jj_consume_token(int kind) throws ParseException {
+ Token oldToken;
+ if ((oldToken = token).next != null) token = token.next;
+ else token = token.next = token_source.getNextToken();
+ jj_ntk = -1;
+ if (token.kind == kind) {
+ jj_gen++;
+ return token;
+ }
+ token = oldToken;
+ jj_kind = kind;
+ throw generateParseException();
+ }
+
+
+/** Get the next Token. */
+ final public Token getNextToken() {
+ if (token.next != null) token = token.next;
+ else token = token.next = token_source.getNextToken();
+ jj_ntk = -1;
+ jj_gen++;
+ return token;
+ }
+
+/** Get the specific Token. */
+ final public Token getToken(int index) {
+ Token t = token;
+ for (int i = 0; i < index; i++) {
+ if (t.next != null) t = t.next;
+ else t = t.next = token_source.getNextToken();
+ }
+ return t;
+ }
+
+ private int jj_ntk() {
+ if ((jj_nt=token.next) == null)
+ return (jj_ntk = (token.next=token_source.getNextToken()).kind);
+ else
+ return (jj_ntk = jj_nt.kind);
+ }
+
+ private java.util.List<int[]> jj_expentries = new java.util.ArrayList<int[]>();
+ private int[] jj_expentry;
+ private int jj_kind = -1;
+
+ /** Generate ParseException. */
+ public ParseException generateParseException() {
+ jj_expentries.clear();
+ boolean[] la1tokens = new boolean[34];
+ if (jj_kind >= 0) {
+ la1tokens[jj_kind] = true;
+ jj_kind = -1;
+ }
+ for (int i = 0; i < 8; i++) {
+ if (jj_la1[i] == jj_gen) {
+ for (int j = 0; j < 32; j++) {
+ if ((jj_la1_0[i] & (1<<j)) != 0) {
+ la1tokens[j] = true;
+ }
+ if ((jj_la1_1[i] & (1<<j)) != 0) {
+ la1tokens[32+j] = true;
+ }
+ }
+ }
+ }
+ for (int i = 0; i < 34; i++) {
+ if (la1tokens[i]) {
+ jj_expentry = new int[1];
+ jj_expentry[0] = i;
+ jj_expentries.add(jj_expentry);
+ }
+ }
+ int[][] exptokseq = new int[jj_expentries.size()][];
+ for (int i = 0; i < jj_expentries.size(); i++) {
+ exptokseq[i] = jj_expentries.get(i);
+ }
+ return new ParseException(token, exptokseq, tokenImage);
+ }
+
+ /** Enable tracing. */
+ final public void enable_tracing() {
+ }
+
+ /** Disable tracing. */
+ final public void disable_tracing() {
+ }
+
+}
Modified: incubator/jena/Jena2/ARQ/trunk/src/org/openjena/atlas/json/io/parserjavacc/javacc/JSON_ParserConstants.java
URL: http://svn.apache.org/viewvc/incubator/jena/Jena2/ARQ/trunk/src/org/openjena/atlas/json/io/parserjavacc/javacc/JSON_ParserConstants.java?rev=1162982&r1=1162981&r2=1162982&view=diff
==============================================================================
--- incubator/jena/Jena2/ARQ/trunk/src/org/openjena/atlas/json/io/parserjavacc/javacc/JSON_ParserConstants.java (original)
+++ incubator/jena/Jena2/ARQ/trunk/src/org/openjena/atlas/json/io/parserjavacc/javacc/JSON_ParserConstants.java Mon Aug 29 20:24:55 2011
@@ -1,124 +1,136 @@
-/* Generated By:JavaCC: Do not edit this line. JSON_ParserConstants.java */
-/*
- * (c) Copyright 2008 Hewlett-Packard Development Company, LP
- * All rights reserved.
- */
-
-package org.openjena.atlas.json.io.parserjavacc.javacc ;
-
-
+/* Generated By:JavaCC: Do not edit this line. JSON_ParserConstants.java */
/**
- * Token literal values and constants.
- * Generated by org.javacc.parser.OtherFilesGen#start()
- */
-public interface JSON_ParserConstants {
-
- /** End of File. */
- int EOF = 0;
- /** RegularExpression Id. */
- int WS = 2;
- /** RegularExpression Id. */
- int ECHAR = 3;
- /** RegularExpression Id. */
- int QUOTE_3D = 4;
- /** RegularExpression Id. */
- int QUOTE_3S = 5;
- /** RegularExpression Id. */
- int STRING_LITERAL1 = 6;
- /** RegularExpression Id. */
- int STRING_LITERAL2 = 7;
- /** RegularExpression Id. */
- int STRING_LITERAL_LONG1 = 8;
- /** RegularExpression Id. */
- int STRING_LITERAL_LONG2 = 9;
- /** RegularExpression Id. */
- int DIGITS = 10;
- /** RegularExpression Id. */
- int INTEGER = 11;
- /** RegularExpression Id. */
- int DECIMAL = 12;
- /** RegularExpression Id. */
- int DOUBLE = 13;
- /** RegularExpression Id. */
- int POSITIVE_INTEGER = 14;
- /** RegularExpression Id. */
- int POSITIVE_DECIMAL = 15;
- /** RegularExpression Id. */
- int POSITIVE_DOUBLE = 16;
- /** RegularExpression Id. */
- int NEGATIVE_INTEGER = 17;
- /** RegularExpression Id. */
- int NEGATIVE_DECIMAL = 18;
- /** RegularExpression Id. */
- int NEGATIVE_DOUBLE = 19;
- /** RegularExpression Id. */
- int EXPONENT = 20;
- /** RegularExpression Id. */
- int TRUE = 21;
- /** RegularExpression Id. */
- int FALSE = 22;
- /** RegularExpression Id. */
- int NULL = 23;
- /** RegularExpression Id. */
- int LBRACE = 24;
- /** RegularExpression Id. */
- int RBRACE = 25;
- /** RegularExpression Id. */
- int LBRACKET = 26;
- /** RegularExpression Id. */
- int RBRACKET = 27;
- /** RegularExpression Id. */
- int LPAREN = 28;
- /** RegularExpression Id. */
- int RPAREN = 29;
- /** RegularExpression Id. */
- int COMMA = 30;
- /** RegularExpression Id. */
- int COLON = 31;
- /** RegularExpression Id. */
- int PLUS = 32;
- /** RegularExpression Id. */
- int MINUS = 33;
-
- /** Lexical state. */
- int DEFAULT = 0;
-
- /** Literal token values. */
- String[] tokenImage = {
- "<EOF>",
- "<token of kind 1>",
- "<WS>",
- "<ECHAR>",
- "\"\\\"\\\"\\\"\"",
- "\"\\\'\\\'\\\'\"",
- "<STRING_LITERAL1>",
- "<STRING_LITERAL2>",
- "<STRING_LITERAL_LONG1>",
- "<STRING_LITERAL_LONG2>",
- "<DIGITS>",
- "<INTEGER>",
- "<DECIMAL>",
- "<DOUBLE>",
- "<POSITIVE_INTEGER>",
- "<POSITIVE_DECIMAL>",
- "<POSITIVE_DOUBLE>",
- "<NEGATIVE_INTEGER>",
- "<NEGATIVE_DECIMAL>",
- "<NEGATIVE_DOUBLE>",
- "<EXPONENT>",
- "\"true\"",
- "\"false\"",
- "\"null\"",
- "\"{\"",
- "\"}\"",
- "\"[\"",
- "\"]\"",
- "\"(\"",
- "\")\"",
- "\",\"",
- "\":\"",
- "\"+\"",
- "\"-\"",
- };
-
-}
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.openjena.atlas.json.io.parserjavacc.javacc ;
+
+
+/**
+ * Token literal values and constants.
+ * Generated by org.javacc.parser.OtherFilesGen#start()
+ */
+public interface JSON_ParserConstants {
+
+ /** End of File. */
+ int EOF = 0;
+ /** RegularExpression Id. */
+ int WS = 2;
+ /** RegularExpression Id. */
+ int ECHAR = 3;
+ /** RegularExpression Id. */
+ int QUOTE_3D = 4;
+ /** RegularExpression Id. */
+ int QUOTE_3S = 5;
+ /** RegularExpression Id. */
+ int STRING_LITERAL1 = 6;
+ /** RegularExpression Id. */
+ int STRING_LITERAL2 = 7;
+ /** RegularExpression Id. */
+ int STRING_LITERAL_LONG1 = 8;
+ /** RegularExpression Id. */
+ int STRING_LITERAL_LONG2 = 9;
+ /** RegularExpression Id. */
+ int DIGITS = 10;
+ /** RegularExpression Id. */
+ int INTEGER = 11;
+ /** RegularExpression Id. */
+ int DECIMAL = 12;
+ /** RegularExpression Id. */
+ int DOUBLE = 13;
+ /** RegularExpression Id. */
+ int POSITIVE_INTEGER = 14;
+ /** RegularExpression Id. */
+ int POSITIVE_DECIMAL = 15;
+ /** RegularExpression Id. */
+ int POSITIVE_DOUBLE = 16;
+ /** RegularExpression Id. */
+ int NEGATIVE_INTEGER = 17;
+ /** RegularExpression Id. */
+ int NEGATIVE_DECIMAL = 18;
+ /** RegularExpression Id. */
+ int NEGATIVE_DOUBLE = 19;
+ /** RegularExpression Id. */
+ int EXPONENT = 20;
+ /** RegularExpression Id. */
+ int TRUE = 21;
+ /** RegularExpression Id. */
+ int FALSE = 22;
+ /** RegularExpression Id. */
+ int NULL = 23;
+ /** RegularExpression Id. */
+ int LBRACE = 24;
+ /** RegularExpression Id. */
+ int RBRACE = 25;
+ /** RegularExpression Id. */
+ int LBRACKET = 26;
+ /** RegularExpression Id. */
+ int RBRACKET = 27;
+ /** RegularExpression Id. */
+ int LPAREN = 28;
+ /** RegularExpression Id. */
+ int RPAREN = 29;
+ /** RegularExpression Id. */
+ int COMMA = 30;
+ /** RegularExpression Id. */
+ int COLON = 31;
+ /** RegularExpression Id. */
+ int PLUS = 32;
+ /** RegularExpression Id. */
+ int MINUS = 33;
+
+ /** Lexical state. */
+ int DEFAULT = 0;
+
+ /** Literal token values. */
+ String[] tokenImage = {
+ "<EOF>",
+ "<token of kind 1>",
+ "<WS>",
+ "<ECHAR>",
+ "\"\\\"\\\"\\\"\"",
+ "\"\\\'\\\'\\\'\"",
+ "<STRING_LITERAL1>",
+ "<STRING_LITERAL2>",
+ "<STRING_LITERAL_LONG1>",
+ "<STRING_LITERAL_LONG2>",
+ "<DIGITS>",
+ "<INTEGER>",
+ "<DECIMAL>",
+ "<DOUBLE>",
+ "<POSITIVE_INTEGER>",
+ "<POSITIVE_DECIMAL>",
+ "<POSITIVE_DOUBLE>",
+ "<NEGATIVE_INTEGER>",
+ "<NEGATIVE_DECIMAL>",
+ "<NEGATIVE_DOUBLE>",
+ "<EXPONENT>",
+ "\"true\"",
+ "\"false\"",
+ "\"null\"",
+ "\"{\"",
+ "\"}\"",
+ "\"[\"",
+ "\"]\"",
+ "\"(\"",
+ "\")\"",
+ "\",\"",
+ "\":\"",
+ "\"+\"",
+ "\"-\"",
+ };
+
+}
Modified: incubator/jena/Jena2/ARQ/trunk/src/org/openjena/atlas/json/io/parserjavacc/javacc/JSON_ParserTokenManager.java
URL: http://svn.apache.org/viewvc/incubator/jena/Jena2/ARQ/trunk/src/org/openjena/atlas/json/io/parserjavacc/javacc/JSON_ParserTokenManager.java?rev=1162982&r1=1162981&r2=1162982&view=diff
==============================================================================
--- incubator/jena/Jena2/ARQ/trunk/src/org/openjena/atlas/json/io/parserjavacc/javacc/JSON_ParserTokenManager.java (original)
+++ incubator/jena/Jena2/ARQ/trunk/src/org/openjena/atlas/json/io/parserjavacc/javacc/JSON_ParserTokenManager.java Mon Aug 29 20:24:55 2011
@@ -1,9 +1,21 @@
/* Generated By:JavaCC: Do not edit this line. JSON_ParserTokenManager.java */
-/*
- * (c) Copyright 2008 Hewlett-Packard Development Company, LP
- * All rights reserved.
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
*/
-
package org.openjena.atlas.json.io.parserjavacc.javacc ;
/** Token Manager. */