diff options
author | buraq <buraq@epfl.ch> | 2003-05-16 15:02:43 +0000 |
---|---|---|
committer | buraq <buraq@epfl.ch> | 2003-05-16 15:02:43 +0000 |
commit | 3096d1674f79316591e520702048b17c78929cbb (patch) | |
tree | cd0fa2f01aa72f46a34938a052c687d712df9f70 /sources/scalac/ast | |
parent | 4071a56256430a1f525372a5fdd4dc575477635a (diff) | |
download | scala-3096d1674f79316591e520702048b17c78929cbb.tar.gz scala-3096d1674f79316591e520702048b17c78929cbb.tar.bz2 scala-3096d1674f79316591e520702048b17c78929cbb.zip |
using PatternNormalizer, fixed recognition of e...
using PatternNormalizer, fixed recognition of empty subsequences
Diffstat (limited to 'sources/scalac/ast')
-rw-r--r-- | sources/scalac/ast/parser/Parser.java | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/sources/scalac/ast/parser/Parser.java b/sources/scalac/ast/parser/Parser.java index 1073f8222f..25abacdd5c 100644 --- a/sources/scalac/ast/parser/Parser.java +++ b/sources/scalac/ast/parser/Parser.java @@ -17,7 +17,7 @@ import Tree.*; /** A recursive descent parser for the programming language Scala. * - * @author Martin Odersky, Matthias Zenger + * @author Martin Odersky, Matthias Zenger, Burak Emir * @version 1.2 */ public class Parser implements Tokens { @@ -30,9 +30,14 @@ public class Parser implements Tokens { */ TreeFactory make; + /** pattern checker and normalizer + */ + PatternNormalizer pN; + public Parser(Unit unit) { s = new Scanner(unit); make = unit.global.make; + pN = new PatternNormalizer( unit ); } /** this is the general parse method @@ -1078,6 +1083,7 @@ public class Parser implements Tokens { */ Tree simplePattern() { switch (s.token) { + case RPAREN: case COMMA: return make.Subsequence( s.pos, Tree.EMPTY_ARRAY ); // ((nothing)) case IDENTIFIER: @@ -1122,7 +1128,10 @@ public class Parser implements Tokens { if( ts.length == 1 ) t = ts[ 0 ]; else - t = make.Subsequence( s.pos, ts ); + { + t = pN.flattenSubsequence( make.Subsequence( s.pos, ts ) ); + t = pN.elimSubsequence( t ); + } accept(RPAREN); return t; default: |