aboutsummaryrefslogtreecommitdiff
path: root/src/monkey
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2010-11-08 11:12:48 +0000
committerChristian Grothoff <christian@grothoff.org>2010-11-08 11:12:48 +0000
commiteacd7e172761853019dfe7122f48a5275b0cabe5 (patch)
tree98397972f340039c749c179a84593de0aa495e80 /src/monkey
parentcc77f1c54d5bc084e82283497af907254041708f (diff)
downloadgnunet-eacd7e172761853019dfe7122f48a5275b0cabe5.tar.gz
gnunet-eacd7e172761853019dfe7122f48a5275b0cabe5.zip
trying to fix grammar
Diffstat (limited to 'src/monkey')
-rw-r--r--src/monkey/seaspider/C.jj29
-rw-r--r--src/monkey/seaspider/org/gnunet/seaspider/ExpressionExtractorVisitor.java14
2 files changed, 36 insertions, 7 deletions
diff --git a/src/monkey/seaspider/C.jj b/src/monkey/seaspider/C.jj
index 9cab0974a..781c516bb 100644
--- a/src/monkey/seaspider/C.jj
+++ b/src/monkey/seaspider/C.jj
@@ -123,8 +123,31 @@ TOKEN : {
123| <#OCTAL_LITERAL: "0" (["0"-"7"])*> 123| <#OCTAL_LITERAL: "0" (["0"-"7"])*>
124| <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"]> 124| <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"]>
125| <#EXPONENT: ["e","E"] (["+","-"])? (["0"-"9"])+> 125| <#EXPONENT: ["e","E"] (["+","-"])? (["0"-"9"])+>
126| <CHARACTER_LITERAL: "\'" (~["\'","\\","\n","\r"] | "\\" (["n","t","b","r","f","\\","\'","\""] | ["0"-"7"] (["0"-"7"])? | ["0"-"3"] ["0"-"7"] ["0"-"7"])) "\'"> 126|
127| <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")))* "\"" )* > 127 < CHARACTER_LITERAL:
128 "'"
129 ( (~["'","\\","\n","\r"])
130 | ("\\"
131 ( ["n","t","b","r","f","\\","'","\""]
132 | ["0"-"7"] ( ["0"-"7"] )?
133 | ["0"-"3"] ["0"-"7"] ["0"-"7"]
134 )
135 )
136 )
137 "'"
138 >
139| < STRING_LITERAL:
140 "\""
141 ( (~["\"","\\","\n","\r"])
142 | ("\\"
143 ( ["n","t","b","r","f","\\","'","\""]
144 | ["0"-"7"] ( ["0"-"7"] )?
145 | ["0"-"3"] ["0"-"7"] ["0"-"7"]
146 )
147 )
148 )*
149 "\""
150 >
128} 151}
129 152
130TOKEN : { 153TOKEN : {
@@ -222,7 +245,7 @@ void ParameterList() : {}
222 245
223void ParameterDeclaration() : {} 246void ParameterDeclaration() : {}
224{ 247{
225 TypeSpecifier() <IDENTIFIER> [ Array () ] 248 TypeSpecifier() [<IDENTIFIER> [ Array () ]]
226} 249}
227 250
228void VariableDeclaration() : {} 251void VariableDeclaration() : {}
diff --git a/src/monkey/seaspider/org/gnunet/seaspider/ExpressionExtractorVisitor.java b/src/monkey/seaspider/org/gnunet/seaspider/ExpressionExtractorVisitor.java
index 7feab1e10..ea3294e2e 100644
--- a/src/monkey/seaspider/org/gnunet/seaspider/ExpressionExtractorVisitor.java
+++ b/src/monkey/seaspider/org/gnunet/seaspider/ExpressionExtractorVisitor.java
@@ -26,6 +26,7 @@ import org.gnunet.seaspider.parser.nodes.JumpStatement;
26import org.gnunet.seaspider.parser.nodes.LogicalANDExpression; 26import org.gnunet.seaspider.parser.nodes.LogicalANDExpression;
27import org.gnunet.seaspider.parser.nodes.LogicalORExpression; 27import org.gnunet.seaspider.parser.nodes.LogicalORExpression;
28import org.gnunet.seaspider.parser.nodes.MultiplicativeExpression; 28import org.gnunet.seaspider.parser.nodes.MultiplicativeExpression;
29import org.gnunet.seaspider.parser.nodes.Node;
29import org.gnunet.seaspider.parser.nodes.NodeChoice; 30import org.gnunet.seaspider.parser.nodes.NodeChoice;
30import org.gnunet.seaspider.parser.nodes.NodeSequence; 31import org.gnunet.seaspider.parser.nodes.NodeSequence;
31import org.gnunet.seaspider.parser.nodes.NodeToken; 32import org.gnunet.seaspider.parser.nodes.NodeToken;
@@ -141,10 +142,15 @@ public class ExpressionExtractorVisitor extends DepthFirstVisitor {
141 public void visit(ParameterDeclaration n) { 142 public void visit(ParameterDeclaration n) {
142 skip_mode = false; 143 skip_mode = false;
143 assert current_expression == null; 144 assert current_expression == null;
144 current_expression = new ExpressionBuilder(); 145 if (n.f1.present())
145 n.f1.accept(this); 146 {
146 LineNumberInfo lin = LineNumberInfo.get(n); 147 NodeSequence ns = (NodeSequence) n.f1.node;
147 current_expression.commit(lin.lineEnd); 148 Node var = ns.elementAt(0);
149 current_expression = new ExpressionBuilder();
150 var.accept(this);
151 LineNumberInfo lin = LineNumberInfo.get(var);
152 current_expression.commit(lin.lineEnd);
153 }
148 current_expression = null; 154 current_expression = null;
149 skip_mode = true; 155 skip_mode = true;
150 } 156 }