trying to fix grammar
authorChristian Grothoff <christian@grothoff.org>
Mon, 8 Nov 2010 11:12:48 +0000 (11:12 +0000)
committerChristian Grothoff <christian@grothoff.org>
Mon, 8 Nov 2010 11:12:48 +0000 (11:12 +0000)
src/monkey/seaspider/C.jj
src/monkey/seaspider/org/gnunet/seaspider/ExpressionExtractorVisitor.java

index 9cab0974af68a09ace963dce4c329ce9806f1fbc..781c516bb3e95ffc37cdf7b51675584816e2d711 100644 (file)
@@ -123,8 +123,31 @@ TOKEN : {
 |  <#OCTAL_LITERAL: "0" (["0"-"7"])*>
 |  <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"])+>
-|  <CHARACTER_LITERAL: "\'" (~["\'","\\","\n","\r"] | "\\" (["n","t","b","r","f","\\","\'","\""] | ["0"-"7"] (["0"-"7"])? | ["0"-"3"] ["0"-"7"] ["0"-"7"])) "\'">
-|  <STRING_LITERAL: "\"" ( ~["\"","\\","\n","\r"] | "\\" ( ["n","t","b","r","f","\\","\'","\""] | ["0"-"7"] (["0"-"7"])?  | ["0"-"3"] ["0"-"7"] ["0"-"7"] | ( ["\n","\r"] | "\r\n")))* "\"" ( ( ["\r","\n"," "] )* "\"" ( ~["\"","\\","\n","\r"] | "\\" ( ["n","t","b","r","f","\\","\'","\""] | ["0"-"7"] (["0"-"7"])?  | ["0"-"3"] ["0"-"7"] ["0"-"7"] | ( ["\n","\r"] | "\r\n")))* "\"" )* >
+|
+  < CHARACTER_LITERAL:
+      "'"
+      (   (~["'","\\","\n","\r"])
+        | ("\\"
+            ( ["n","t","b","r","f","\\","'","\""]
+            | ["0"-"7"] ( ["0"-"7"] )?
+            | ["0"-"3"] ["0"-"7"] ["0"-"7"]
+            )
+          )
+      )
+      "'"
+  >
+|   < STRING_LITERAL:
+      "\""
+      (   (~["\"","\\","\n","\r"])
+        | ("\\"
+            ( ["n","t","b","r","f","\\","'","\""]
+            | ["0"-"7"] ( ["0"-"7"] )?
+            | ["0"-"3"] ["0"-"7"] ["0"-"7"]
+            )
+          )
+      )*
+      "\""
+  >
 }
 
 TOKEN : {
@@ -222,7 +245,7 @@ void ParameterList() : {}
 
 void ParameterDeclaration() : {}
 {
-       TypeSpecifier() <IDENTIFIER> [ Array () ]
+       TypeSpecifier() [<IDENTIFIER> [ Array () ]]
 }
 
 void VariableDeclaration() : {}
index 7feab1e1082fc6a6f8824acb0e71c917358fddaa..ea3294e2e7b5e1787d236cb335afcc44acd0962f 100644 (file)
@@ -26,6 +26,7 @@ import org.gnunet.seaspider.parser.nodes.JumpStatement;
 import org.gnunet.seaspider.parser.nodes.LogicalANDExpression;
 import org.gnunet.seaspider.parser.nodes.LogicalORExpression;
 import org.gnunet.seaspider.parser.nodes.MultiplicativeExpression;
+import org.gnunet.seaspider.parser.nodes.Node;
 import org.gnunet.seaspider.parser.nodes.NodeChoice;
 import org.gnunet.seaspider.parser.nodes.NodeSequence;
 import org.gnunet.seaspider.parser.nodes.NodeToken;
@@ -141,10 +142,15 @@ public class ExpressionExtractorVisitor extends DepthFirstVisitor {
        public void visit(ParameterDeclaration n) {
                skip_mode = false;
                assert current_expression == null;
-               current_expression = new ExpressionBuilder();
-               n.f1.accept(this);
-               LineNumberInfo lin = LineNumberInfo.get(n);
-               current_expression.commit(lin.lineEnd);
+               if (n.f1.present())
+               {
+                       NodeSequence ns = (NodeSequence) n.f1.node;
+                       Node var = ns.elementAt(0);
+                       current_expression = new ExpressionBuilder();
+                       var.accept(this);
+                       LineNumberInfo lin = LineNumberInfo.get(var);
+                       current_expression.commit(lin.lineEnd);
+               }
                current_expression = null;
                skip_mode = true;
        }