Changeset 1907
- Timestamp:
- 06/13/08 07:38:58 (6 months ago)
- Files:
-
- trunk/ProjectFortress/astgen/Fortress.ast (modified) (4 diffs)
- trunk/ProjectFortress/build.xml (modified) (1 diff)
- trunk/ProjectFortress/src/com/sun/fortress/nodes_util/ExprFactory.java (modified) (4 diffs)
- trunk/ProjectFortress/src/com/sun/fortress/parser/Expression.rats (modified) (3 diffs)
- trunk/ProjectFortress/src/com/sun/fortress/parser/Fortress.rats (modified) (4 diffs)
- trunk/ProjectFortress/src/com/sun/fortress/parser/Gaps.rats (deleted)
- trunk/ProjectFortress/src/com/sun/fortress/parser/Identifier.rats (modified) (4 diffs)
- trunk/ProjectFortress/src/com/sun/fortress/parser/Literal.rats (modified) (6 diffs)
- trunk/ProjectFortress/src/com/sun/fortress/parser/preparser/PreFortress.rats (modified) (1 diff)
- trunk/ProjectFortress/src/com/sun/fortress/parser/templateparser/Expression.rats (modified) (1 diff)
- trunk/ProjectFortress/src/com/sun/fortress/parser/templateparser/Gaps.rats (modified) (2 diffs)
- trunk/ProjectFortress/src/com/sun/fortress/parser/templateparser/Identifier.rats (modified) (1 diff)
- trunk/ProjectFortress/src/com/sun/fortress/parser/templateparser/Literal.rats (modified) (1 diff)
- trunk/ProjectFortress/src/com/sun/fortress/parser/templateparser/TemplateParser.rats (modified) (1 diff)
- trunk/ProjectFortress/src/com/sun/fortress/syntax_abstractions/phases/ModuleEnvironment.java (modified) (1 diff)
- trunk/ProjectFortress/src/com/sun/fortress/syntax_abstractions/rats/util/ModuleInfo.java (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/ProjectFortress/astgen/Fortress.ast
r1899 r1907 724 724 abstract DelimitedExpr(); 725 725 /** 726 * Template gap for expressions 727 */ 728 TemplateGapDelimitedExpr(Id id, List<Id> templateParams) implements TemplateGap; 729 /** 726 730 * sequence of block elements implicitly enclosed by do/end 727 731 * BlockElems ::= BlockElem+ … … 999 1003 abstract SimpleExpr(); 1000 1004 /** 1005 * Template gap for simple expressions 1006 */ 1007 TemplateGapSimpleExpr(Id id, List<Id> templateParams) implements TemplateGap; 1008 /** 1001 1009 * subscripting expression 1002 1010 * SubscriptExpr ::= Primary LeftEncloser ExprList? RightEncloser … … 1012 1020 */ 1013 1021 abstract Primary(); 1022 /** 1023 * Template gap for primary expressions 1024 */ 1025 TemplateGapPrimary(Id id, List<Id> templateParams) implements TemplateGap; 1014 1026 /** 1015 1027 * literal … … 1941 1953 abstract Name(); 1942 1954 /** 1955 * Template gap for names 1956 */ 1957 TemplateGapName(Id id, List<Id> templateParams) implements TemplateGap; 1958 /** 1943 1959 * unstructured sequence of ids naming an API or component 1944 1960 * APIName ::= Id(.Id)* trunk/ProjectFortress/build.xml
r1905 r1907 541 541 </target> 542 542 543 <target name="test SyntaxAbs" depends="compile"543 <target name="testsyntax" depends="compile" 544 544 description="Run SyntaxAbstractionJUTests."> 545 545 <mkdir dir="${test.results}"/> trunk/ProjectFortress/src/com/sun/fortress/nodes_util/ExprFactory.java
r1899 r1907 85 85 import com.sun.fortress.nodes.SubscriptingMI; 86 86 import com.sun.fortress.nodes.TemplateGapCharLiteralExpr; 87 import com.sun.fortress.nodes.TemplateGapDelimitedExpr; 87 88 import com.sun.fortress.nodes.TemplateGapExpr; 88 89 import com.sun.fortress.nodes.TemplateGapFloatLiteralExpr; 89 90 import com.sun.fortress.nodes.TemplateGapFnExpr; 91 import com.sun.fortress.nodes.TemplateGapName; 90 92 import com.sun.fortress.nodes.TemplateGapId; 91 93 import com.sun.fortress.nodes.TemplateGapIntLiteralExpr; … … 93 95 import com.sun.fortress.nodes.TemplateGapLooseJuxt; 94 96 import com.sun.fortress.nodes.TemplateGapNumberLiteralExpr; 97 import com.sun.fortress.nodes.TemplateGapPrimary; 98 import com.sun.fortress.nodes.TemplateGapSimpleExpr; 95 99 import com.sun.fortress.nodes.TemplateGapStringLiteralExpr; 96 100 import com.sun.fortress.nodes.TemplateGapVoidLiteralExpr; … … 811 815 } 812 816 817 public static TemplateGapDelimitedExpr makeTemplateGapDelimitedExpr(Span s, Id id, List<Id> params) { 818 return new TemplateGapDelimitedExpr(s, id, params); 819 } 820 821 public static TemplateGapSimpleExpr makeTemplateGapSimpleExpr(Span s, Id id, List<Id> params) { 822 return new TemplateGapSimpleExpr(s, id, params); 823 } 824 825 public static TemplateGapPrimary makeTemplateGapPrimary(Span s, Id id, List<Id> params) { 826 return new TemplateGapPrimary(s, id, params); 827 } 828 813 829 public static TemplateGapFnExpr makeTemplateGapFnExpr(Span s, Id id, List<Id> params) { 814 830 Expr body = new VarRef(id); … … 820 836 } 821 837 838 public static TemplateGapName makeTemplateGapName(Span s, Id id, List<Id> params) { 839 return new TemplateGapName(s, id, params); 840 } 841 822 842 public static TemplateGapId makeTemplateGapId(Span s, Id id, List<Id> params) { 823 843 return new TemplateGapId(s, "IdGap:"+id.getText(), id, params); trunk/ProjectFortress/src/com/sun/fortress/parser/Expression.rats
r1899 r1907 22 22 MayNewlineHeader, Type, DelimitedExpr, 23 23 Literal, Identifier, Keyword, Symbol, 24 Spacing , Gaps);24 Spacing); 25 25 26 26 import Param; … … 34 34 import Symbol; 35 35 import Spacing; 36 import Gaps;37 36 38 37 /* Expr ::= … … 53 52 / DelimitedExpr 54 53 / <Flow> FlowExpr 55 / ExprGap56 / FnExprGap57 54 / <Fn> fn w a1:ValParam a2:(w IsType)? a3:(w Throws)? w match w a4:Expr 58 55 { Option<Type> ty_opt = Option.wrap(a2); trunk/ProjectFortress/src/com/sun/fortress/parser/Fortress.rats
r1895 r1907 87 87 DelimitedExpr, Literal, 88 88 Identifier, Keyword, Symbol, 89 Spacing , Gaps)89 Spacing) 90 90 as Expression; 91 91 instantiate com.sun.fortress.parser.DelimitedExpr(TraitObject, NoNewlineHeader, … … 103 103 instantiate com.sun.fortress.parser.Literal(MayNewlineHeader, DelimitedExpr, 104 104 NoSpaceExpr, Symbol, 105 Spacing, Identifier , Gaps)105 Spacing, Identifier) 106 106 as Literal; 107 107 instantiate com.sun.fortress.parser.LocalDecl(Variable, Function, Parameter, … … 112 112 as LocalDecl; 113 113 instantiate com.sun.fortress.parser.Identifier(Keyword, Symbol, 114 Unicode, Spacing , Gaps)114 Unicode, Spacing) 115 115 as Identifier; 116 116 instantiate com.sun.fortress.parser.Symbol(DelimitedExpr, LocalDecl, … … 124 124 instantiate com.sun.fortress.parser.Unicode 125 125 as Unicode; 126 instantiate com.sun.fortress.parser.Gaps(Symbol, Spacing, Identifier)127 as Gaps;128 126 129 127 header { trunk/ProjectFortress/src/com/sun/fortress/parser/Identifier.rats
r1849 r1907 20 20 */ 21 21 module com.sun.fortress.parser.Identifier(Keyword, Symbol, Unicode, 22 Spacing , Gaps);22 Spacing); 23 23 24 24 import Keyword; … … 26 26 import Unicode; 27 27 import Spacing; 28 import Gaps;29 28 30 29 option setOfString(FORTRESS_KEYWORDS); … … 52 51 53 52 Id Id = 54 IdGap 55 / a1:IdText { yyValue = new Id(createSpan(yyStart,yyCount), a1); }; 53 <FIRST> a1:IdText { yyValue = new Id(createSpan(yyStart,yyCount), a1); }; 56 54 57 55 /* BindId ::= Id / _ */ … … 69 67 */ 70 68 List<Id> BindIdOrBindIdTuple = 71 BindIdOrBindIdTupleGap 72 / a1:BindId 69 <FIRST> a1:BindId 73 70 { yyValue = FortressUtil.mkList(a1); } 74 71 / openparen w a1:BindId w comma w a2s:BindIdList w closeparen trunk/ProjectFortress/src/com/sun/fortress/parser/Literal.rats
r1849 r1907 21 21 module com.sun.fortress.parser.Literal(MayNewlineHeader, DelimitedExpr, 22 22 NoSpaceExpr, Symbol, Spacing, 23 Identifier , Gaps);23 Identifier); 24 24 25 25 import MayNewlineHeader; … … 29 29 import Spacing; 30 30 import Identifier; 31 import Gaps;32 31 33 32 /* LiteralExpr ::= … … 38 37 */ 39 38 Expr LiteralExpr = 40 ExprGap 41 / LooseJuxtGap 42 / LiteralExprGap 43 / <VOID> VoidLiteralExpr 39 <VOID> VoidLiteralExpr 44 40 / <NUMERICAL> NumericLiteralExpr 45 41 / <CHAR>CharLiteralExpr … … 69 65 70 66 Expr VoidLiteralExpr = 71 VoidLiteralExprGap 72 / <VOID> openparen w closeparen 67 <FIRST> openparen w closeparen 73 68 { yyValue = ExprFactory.makeVoidLiteralExpr(createSpan(yyStart,yyCount)); }; 74 69 75 70 NumberLiteralExpr NumericLiteralExpr = 76 NumberLiteralExprGap 77 / FloatLiteralExpr 71 FloatLiteralExpr 78 72 / IntLiteralExpr ; 79 73 80 74 transient FloatLiteralExpr FloatLiteralExpr = 81 FloatLiteralExprGap 82 / a1:DigitString dot a2:DigitString 75 <FIRST> a1:DigitString dot a2:DigitString 83 76 { yyValue = ExprFactory.makeFloatLiteralExpr(createSpan(yyStart,yyCount), 84 77 a1 + "." + a2); }; 85 78 86 79 transient IntLiteralExpr IntLiteralExpr = 87 IntLiteralExprGap 88 / a1:DigitString 80 <FIRST> a1:DigitString 89 81 { yyValue = ExprFactory.makeIntLiteralExpr(createSpan(yyStart,yyCount), 90 82 a1); … … 94 86 95 87 CharLiteralExpr CharLiteralExpr = 96 CharLiteralExprGap 97 / "'" a1:CharLiteralContent "'" 88 <FIRST> "'" a1:CharLiteralContent "'" 98 89 { yyValue = ExprFactory.makeCharLiteralExpr(createSpan(yyStart,yyCount), 99 90 a1); … … 101 92 102 93 StringLiteralExpr StringLiteralExpr = 103 StringLiteralExprGap 104 / ["] a1:StringLiteralContent* ["] 94 <FIRST> ["] a1:StringLiteralContent* ["] 105 95 { String str = ""; 106 96 for (String c : (List<String>)a1.list()) { trunk/ProjectFortress/src/com/sun/fortress/parser/preparser/PreFortress.rats
r1895 r1907 23 23 24 24 instantiate com.sun.fortress.parser.Spacing (PreSymbol) as Spacing; 25 instantiate com.sun.fortress.parser.Identifier (Keyword, PreSymbol, Unicode, Spacing , Gaps) as Identifier;25 instantiate com.sun.fortress.parser.Identifier (Keyword, PreSymbol, Unicode, Spacing) as Identifier; 26 26 instantiate com.sun.fortress.parser.Keyword (Identifier) as Keyword; 27 27 instantiate com.sun.fortress.parser.Unicode as Unicode; 28 instantiate com.sun.fortress.parser.Gaps(PreSymbol, Spacing, Identifier) as Gaps;29 28 instantiate com.sun.fortress.parser.preparser.PreSymbol (Identifier, Spacing, Keyword) as PreSymbol; 30 29 trunk/ProjectFortress/src/com/sun/fortress/parser/templateparser/Expression.rats
r1903 r1907 38 38 modify com.sun.fortress.parser.Expression(Param, NoNewlineHeader, 39 39 MayNewlineHeader, Type, DelimitedExpr, Literal, Identifier, Keyword, 40 Symbol, Spacing, Gaps); 40 Symbol, Spacing); 41 42 43 Expr ExprFront += 44 ExprGap 45 / LooseJuxtGap 46 / FnExprGap 47 / <Fn> ... ; trunk/ProjectFortress/src/com/sun/fortress/parser/templateparser/Gaps.rats
r1903 r1907 38 38 }; 39 39 40 Expr DelimitedExprGap = 41 <GAP> prefix "DelimitedExpr" w a1:Id params:ParamList? w suffix 42 { if (params == null) params = new LinkedList<Id>(); 43 yyValue = ExprFactory.makeTemplateGapDelimitedExpr(createSpan(yyStart,yyCount), a1, params); 44 }; 45 46 Expr SimpleExprGap = 47 <GAP> prefix "SimpleExpr" w a1:Id params:ParamList? w suffix 48 { if (params == null) params = new LinkedList<Id>(); 49 yyValue = ExprFactory.makeTemplateGapSimpleExpr(createSpan(yyStart,yyCount), a1, params); 50 }; 51 52 Expr PrimaryGap = 53 <GAP> prefix "Primary" w a1:Id params:ParamList? w suffix 54 { if (params == null) params = new LinkedList<Id>(); 55 yyValue = ExprFactory.makeTemplateGapPrimary(createSpan(yyStart,yyCount), a1, params); 56 }; 57 40 58 FnExpr FnExprGap = 41 59 <GAP> prefix "FnExpr" w a1:Id params:ParamList? w suffix … … 51 69 52 70 List<Id> BindIdOrBindIdTupleGap = 53 <GAP> prefix " BindIdOrBindIdTuple" w a1:Id params:ParamList? w suffix71 <GAP> prefix "List<Id>" w a1:Id params:ParamList? w suffix 54 72 { if (params == null) params = new LinkedList<Id>(); 55 73 TemplateGapId t = ExprFactory.makeTemplateGapId(createSpan(yyStart,yyCount), a1, params); 56 74 yyValue = FortressUtil.<Id, TemplateGapId>mkList(t); 75 }; 76 77 Name NameGap = 78 <GAP> prefix "Name" w a1:Id params:ParamList? w suffix 79 { if (params == null) params = new LinkedList<Id>(); 80 yyValue = ExprFactory.makeTemplateGapName(createSpan(yyStart,yyCount), a1, params); 57 81 }; 58 82 trunk/ProjectFortress/src/com/sun/fortress/parser/templateparser/Identifier.rats
r1903 r1907 29 29 30 30 modify com.sun.fortress.parser.Identifier(Keyword, Symbol, Unicode, 31 Gaps, Spacing); 31 Spacing); 32 33 34 Id Id += 35 NameGap 36 / IdGap 37 / <FIRST> ... ; 38 39 List<Id> BindIdOrBindIdTuple += 40 BindIdOrBindIdTupleGap 41 / <FIRST> ... ; trunk/ProjectFortress/src/com/sun/fortress/parser/templateparser/Literal.rats
r1903 r1907 32 32 33 33 modify com.sun.fortress.parser.Literal(MayNewlineHeader, 34 DelimitedExpr, NoSpaceExpr, Symbol, Spacing, Identifier, Gaps); 34 DelimitedExpr, NoSpaceExpr, Symbol, Spacing, Identifier); 35 36 Expr LiteralExpr += 37 ExprGap 38 / LooseJuxtGap 39 / SimpleExprGap 40 / PrimaryGap 41 / LiteralExprGap 42 / <VOID> ...; 43 44 Expr VoidLiteralExpr += 45 VoidLiteralExprGap 46 / <FIRST> ...; 47 48 FloatLiteralExpr FloatLiteralExpr += 49 NumberLiteralExprGap 50 / FloatLiteralExprGap 51 / <FIRST> ...; 52 53 IntLiteralExpr IntLiteralExpr += 54 NumberLiteralExprGap 55 / IntLiteralExprGap 56 / <FIRST> ...; 57 58 CharLiteralExpr CharLiteralExpr += 59 CharLiteralExprGap 60 / <FIRST> ...; 61 62 StringLiteralExpr StringLiteralExpr += 63 StringLiteralExprGap 64 / <FIRST> ... ; 65 trunk/ProjectFortress/src/com/sun/fortress/parser/templateparser/TemplateParser.rats
r1903 r1907 124 124 instantiate com.sun.fortress.parser.templateparser.Unicode 125 125 as Unicode; 126 instantiate com.sun.fortress.parser. Gaps(Symbol, Spacing, Identifier)126 instantiate com.sun.fortress.parser.templateparser.Gaps(Symbol, Spacing, Identifier) 127 127 as Gaps; 128 128 trunk/ProjectFortress/src/com/sun/fortress/syntax_abstractions/phases/ModuleEnvironment.java
r1899 r1907 193 193 m.getDependencies().add(new ModuleImport(identifier)); 194 194 m.getParameters().add(identifier); 195 ModuleName gaps = new ModuleName("Gaps");196 m.getDependencies().add(new ModuleImport(gaps));197 m.getParameters().add(gaps);198 195 } 199 196 m.getParameters().addAll(makeParameters(nt.getDependencies())); trunk/ProjectFortress/src/com/sun/fortress/syntax_abstractions/rats/util/ModuleInfo.java
r1899 r1907 61 61 fortressModules.add("Fortress"); 62 62 fortressModules.add("Function"); 63 fortressModules.add("Gaps");64 63 fortressModules.add("Header"); 65 64 fortressModules.add("Identifier");
