diff options
author | Christian Grothoff <christian@grothoff.org> | 2010-11-08 11:12:48 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2010-11-08 11:12:48 +0000 |
commit | eacd7e172761853019dfe7122f48a5275b0cabe5 (patch) | |
tree | 98397972f340039c749c179a84593de0aa495e80 /src/monkey | |
parent | cc77f1c54d5bc084e82283497af907254041708f (diff) | |
download | gnunet-eacd7e172761853019dfe7122f48a5275b0cabe5.tar.gz gnunet-eacd7e172761853019dfe7122f48a5275b0cabe5.zip |
trying to fix grammar
Diffstat (limited to 'src/monkey')
-rw-r--r-- | src/monkey/seaspider/C.jj | 29 | ||||
-rw-r--r-- | src/monkey/seaspider/org/gnunet/seaspider/ExpressionExtractorVisitor.java | 14 |
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 | ||
130 | TOKEN : { | 153 | TOKEN : { |
@@ -222,7 +245,7 @@ void ParameterList() : {} | |||
222 | 245 | ||
223 | void ParameterDeclaration() : {} | 246 | void ParameterDeclaration() : {} |
224 | { | 247 | { |
225 | TypeSpecifier() <IDENTIFIER> [ Array () ] | 248 | TypeSpecifier() [<IDENTIFIER> [ Array () ]] |
226 | } | 249 | } |
227 | 250 | ||
228 | void VariableDeclaration() : {} | 251 | void 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; | |||
26 | import org.gnunet.seaspider.parser.nodes.LogicalANDExpression; | 26 | import org.gnunet.seaspider.parser.nodes.LogicalANDExpression; |
27 | import org.gnunet.seaspider.parser.nodes.LogicalORExpression; | 27 | import org.gnunet.seaspider.parser.nodes.LogicalORExpression; |
28 | import org.gnunet.seaspider.parser.nodes.MultiplicativeExpression; | 28 | import org.gnunet.seaspider.parser.nodes.MultiplicativeExpression; |
29 | import org.gnunet.seaspider.parser.nodes.Node; | ||
29 | import org.gnunet.seaspider.parser.nodes.NodeChoice; | 30 | import org.gnunet.seaspider.parser.nodes.NodeChoice; |
30 | import org.gnunet.seaspider.parser.nodes.NodeSequence; | 31 | import org.gnunet.seaspider.parser.nodes.NodeSequence; |
31 | import org.gnunet.seaspider.parser.nodes.NodeToken; | 32 | import 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 | } |