Commit ec3626d1 authored by Anders Nilsson's avatar Anders Nilsson
Browse files

Synching. Soon, maybe, string elements can be parsed OK

parent a4468abb
......@@ -18,7 +18,7 @@ aspect AbsGrammarGeneration {
pStream.println("ComplexElement : Element ::= OwlIdentifier Attribute* Element*;");
// pStream.println("ComplexElement ::= id1:OwlIdentifier id2:OwlIdentifier;");
pStream.println("abstract SimpleElement : Element;");
pStream.println("StringElement : SimpleElement ::= <IDENTIFIER>;");
pStream.println("StringElement : SimpleElement ::= OwlIdentifier;");
pStream.println("IntElement : SimpleElement ::= <INTEGER_LITERAL>;");
pStream.println("FloatElement : SimpleElement ::= <FLOAT_LITERAL>;");
pStream.println("Attribute ::= Value;");
......
......@@ -234,9 +234,10 @@ SPECIAL_TOKEN : /* COMMENTS */
<DEFAULT,BOUNDS> TOKEN : /* OPERATORS */
{
< ASSIGN : "=" >
| < GT : ">" >
| < LT : "<" >
| < END_TAG : "/>" >
| < END_TAG : ">" >
| < START_ENDTAG : "</" >
| < START_TAG : "<" >
| < END_TAGS : "/>" >
// | < BANG : "!" >
// | < TILDE : "~" >
// | < HOOK : "?" >
......@@ -249,10 +250,10 @@ SPECIAL_TOKEN : /* COMMENTS */
// | < SC_AND : "&&" >
// | < INCR : "++" >
// | < DECR : "--" >
// | < PLUS : "+" >
// | < MINUS : "-" >
| < PLUS : "+" >
| < MINUS : "-" >
// | < STAR : "*" >
// | < SLASH : "/" >
| < SLASH : "/" >
// | < BIT_AND : "&" >
// | < BIT_OR : "|" >
// | < XOR : "^" >
......@@ -274,12 +275,12 @@ SPECIAL_TOKEN : /* COMMENTS */
}// OPERATORS
<DEFAULT,BOUNDS> TOKEN : /* TEXT */
{
< VALUE_LITERAL:
(<LETTER> | <DIGIT>) ( ~["<"] )*
>
}// TEXT
// <VALUESTATE,BOUNDS> TOKEN : /* TEXT */
// {
// < VALUE_LITERAL:
// (<LETTER> | <DIGIT>) ( ~["<"] )*
// >
// }// TEXT
......@@ -347,7 +348,8 @@ void SimpleElement() : {}
{
IntElement()
| FloatElement()
| StringElement()
// | LOOKAHEAD({getToken(1).kind != START_ENDTAG}) StringElement()
| StringElement()
}
void IntElement() #IntElement : { Token t; }
......@@ -362,10 +364,37 @@ void FloatElement() #FloatElement : { Token t; }
{jjtThis.setFLOAT_LITERAL(t.image);}
}
void StringElement() #StringElement : { Token t; }
// JAVACODE
// public void StringElement() {
// StringElement se = new StringElement();
// Token tok;
// StringBuffer buf = new StringBuffer();
// jjtree.openNodeScope(se);
// try {
// while (true) {
// tok = getToken(1);
// if (tok.kind == START_ENDTAG) break;
// if (tok.kind == EOF) throw new ParseException();
// buf.append(tok.image);
// tok = getNextToken();
// }
// } finally {
// jjtree.closeNodeScope(se,true);
// se.setIDENTIFIER(buf.toString());
// }
// }
void StringElement() #StringElement : {} //{ Token t; }
{
Identifier()
// WordList()
// t = <VALUE_LITERAL>
// {jjtThis.setIDENTIFIER(t.image);}
}
void WordList() #List : {}
{
t = <VALUE_LITERAL>
{jjtThis.setIDENTIFIER(t.image);}
Identifier() ( Identifier() )*
}
// void OwlElement() : {}
......
<VacuumGripper>
1
Hej Världen
</VacuumGripper>
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment