Exemplo n.º 1
0
 public static void SetUp(Module module, Grammar grammar)
 {
     if (pattern == null)
     {
         BlockCommentPrototype.pattern
             = new AbstractPattern(null, "BlockCommentPrototype");    
         
         BlockCommentPrototype.pattern.SetType(typeof(BlockCommentPrototype));
         grammar.PatternDefined(BlockCommentPrototype.pattern);
         
         string expression = "s('/*' *(s(!('*/') a(0 any))) '*/')";
         ParseGraphNode parseGraph = BootstrapParser.Parse(expression,
             new Pattern[]{BlockCommentPrototype.pattern});
     
         pattern = new ConcretePattern(null, "BlockComment",
             parseGraph);
         
         pattern.SetType(typeof(BlockComment));
         
         BlockCommentPrototype.pattern.AddAltPattern(pattern);
     }
     
     module.SetName("BlockComment", typeof(BlockComment));
     grammar.PatternDefined(pattern);
 }
Exemplo n.º 2
0
 public static void SetUp(Module module, Grammar grammar)
 {
     if (pattern == null)
     {
         pattern = new AbstractPattern(null, "Expression");
         pattern.SetType(typeof(Expression));
     }
     
     module.SetName("Expression", typeof(Expression));
     grammar.PatternDefined(pattern);
 }
Exemplo n.º 3
0
 public static void SetUp(Module module, Grammar grammar)
 {
     if (pattern == null)
     {
         pattern = new AbstractPattern(null, "Statement");
         pattern.SetType(typeof(Statement));
     }
     
     module.SetName("Statement", typeof(Statement));
     grammar.PatternDefined(pattern);
 }
Exemplo n.º 4
0
 public new static void SetUp(Module module, Grammar grammar)
 {
     if (pattern == null)
     {
         pattern = new AbstractPattern(null, "ComparisonExpression");
         pattern.SetType(typeof(ComparisonExpression));
         
         Expression.pattern.AddAltPattern(pattern);
     }
     
     module.SetName("ComparisonExpression", typeof(ComparisonExpression));
     grammar.PatternDefined(pattern);
 }
Exemplo n.º 5
0
 public static void SetUp(Module module, Grammar grammar)
 {
     if (pattern == null)
     {
         string expression = "l(text o((whitespace null) t( s( '\\\"' *( a( s( !(a('\\\\' '\\\"')) any ) s('\\\\' a('\\\\' 'r' 'n' 't' '\\\"' '\\\'' '0') ) ) ) '\\\"' ) ) ) )";
         ParseGraphNode parseGraph = BootstrapParser.Parse(expression, null);
 
         pattern = new ConcretePattern(null, "String", parseGraph);
         pattern.SetType(typeof(String));
     }
     
     module.SetName("String", typeof(String));
     grammar.PatternDefined(pattern);
 }
Exemplo n.º 6
0
 public static void SetUp(Module module, Grammar grammar)
 {
     if (pattern == null)
     {
         string expression = "l(number o((whitespace null) t(s(+(r('0' '9')) ?(s('.' +(r('0' '9'))))))))";
     
         ParseGraphNode parseGraph = BootstrapParser.Parse(expression, null);
 
         pattern = new ConcretePattern(null, "Number", parseGraph);
         pattern.SetType(typeof(Number));
     }
     
     module.SetName("Number", typeof(Number));
     grammar.PatternDefined(pattern);
 }
Exemplo n.º 7
0
 public static void SetUp(Module module, Grammar grammar)
 {
     if (pattern == null)
     {
         string expression = "+(a(' ' '\\t' s('\\r' ?('\\n')) '\\n'))";
     
         ParseGraphNode parseGraph = BootstrapParser.Parse(expression, null);
     
         pattern = new ConcretePattern(null, "DefaultWhitespace", parseGraph);
         pattern.SetType(typeof(DefaultWhitespace));
     }
     
     module.SetName("DefaultWhitespace", typeof(DefaultWhitespace));
     grammar.PatternDefined(pattern);
 }
Exemplo n.º 8
0
 public new static void SetUp(Module module, Grammar grammar)
 {
     if (pattern == null)
     {
         ParseGraphNode parseGraph = BootstrapParser.Parse("'.'", null);
 
         pattern = new ConcretePattern(null, "AnyPatternExpression", parseGraph);
         pattern.SetType(typeof(AnyPatternExpression));
     
         PatternExpression.pattern.AddAltPattern(pattern);
     }
     
     module.SetName("AnyPatternExpression", typeof(AnyPatternExpression));
     grammar.PatternDefined(pattern);
 }
Exemplo n.º 9
0
 public static void SetUp(Module module, Grammar grammar)
 {
     if (pattern == null)
     {
         string expression = "s('//' *(s(!(a( s('\r' ?('\n')) '\n' )) any)))";
     
         ParseGraphNode parseGraph = BootstrapParser.Parse(expression, null);
     
         pattern = new ConcretePattern(null, "LineComment", parseGraph);
         pattern.SetType(typeof(LineComment));
     }
     
     module.SetName("LineComment", typeof(LineComment));
     grammar.PatternDefined(pattern);
 }
Exemplo n.º 10
0
 public static void SetUp(Module module, Grammar grammar)
 {
     if (pattern == null)
     {
         string expression = "o((whitespace 0) l(statements *(1)))";
         Pattern[] patterns = {Whitespace.pattern, TopLevelStatement.pattern};
     
         ParseGraphNode parseGraph = BootstrapParser.Parse(expression, patterns);
     
         pattern = new ConcretePattern(null, "Program", parseGraph);
         pattern.SetType(typeof(Program));
     }
     
     module.SetName("Program", typeof(Program));
     grammar.PatternDefined(pattern);
 }
Exemplo n.º 11
0
 public static void SetUp(Module module, Grammar grammar)
 {
     if (pattern == null)
     {
         string expression = "+(a(0 1 2))";
         Pattern[] patterns = {LineComment.pattern, BlockComment.pattern, DefaultWhitespace.pattern};
         
         ParseGraphNode parseGraph = BootstrapParser.Parse(expression, patterns);
     
         pattern = new ConcretePattern(null, "Whitespace", parseGraph);
         pattern.SetType(typeof(Whitespace));
     }
     
     module.SetName("Whitespace", typeof(Whitespace));
     grammar.PatternDefined(pattern);
 }
Exemplo n.º 12
0
 public new static void SetUp(Module module, Grammar grammar)
 {
     if (pattern == null)
     {
         string expression = "s('option' l(optionKey 0) ?(s('=' o((dropPrecedence true) l(optionValue 1)))) ';')";
         Pattern[] patterns = {Name.pattern, Expression.pattern};
     
         ParseGraphNode parseGraph = BootstrapParser.Parse(expression, patterns);
 
         pattern = new ConcretePattern(null, "Option", parseGraph);
         pattern.SetType(typeof(Option));
     }
     
     module.SetName("Option", typeof(Option));
     grammar.PatternDefined(pattern);
 }
Exemplo n.º 13
0
 public new static void SetUp(Module module, Grammar grammar)
 {
     if (pattern == null)
     {
         string expression = "l(statement 0)";
         Pattern[] parameters = {Statement.pattern};
     
         ParseGraphNode parseGraph = BootstrapParser.Parse(expression, parameters);
     
         pattern = new ConcretePattern(null, "TopLevelStatement", parseGraph);
         pattern.SetType(typeof(TopLevelStatement));
     }
     
     module.SetName("TopLevelStatement", typeof(TopLevelStatement));
     grammar.PatternDefined(pattern);
 }
Exemplo n.º 14
0
 public new static void SetUp(Module module, Grammar grammar)
 {
     if (pattern == null)
     {
         string expression = "o((recursive false) s(l(label 0) ':' l(body 1)))";
         Pattern[] patterns = {Name.pattern, PatternExpression.pattern};
     
         ParseGraphNode parseGraph = BootstrapParser.Parse(expression, patterns);
 
         pattern = new ConcretePattern(null, "LabelPatternExpression", parseGraph);
         pattern.SetType(typeof(LabelPatternExpression));
     
         PatternExpression.pattern.AddAltPattern(pattern);
     }
     
     module.SetName("LabelPatternExpression", typeof(LabelPatternExpression));
     grammar.PatternDefined(pattern);
 }
Exemplo n.º 15
0
 public new static void SetUp(Module module, Grammar grammar)
 {
     if (pattern == null)
     {
         string expression = "s('{' l(options *(0)) o((dropPrecedence true) l(body 1)) '}')";
         Pattern[] patterns = {Option.pattern, PatternExpression.pattern};
     
         ParseGraphNode parseGraph = BootstrapParser.Parse(expression, patterns);
 
         pattern = new ConcretePattern(null, "BlockPatternExpression", parseGraph);
         pattern.SetType(typeof(BlockPatternExpression));
     
         PatternExpression.pattern.AddAltPattern(pattern);
     }
     
     module.SetName("BlockPatternExpression", typeof(BlockPatternExpression));
     grammar.PatternDefined(pattern);
 }
Exemplo n.º 16
0
 public new static void SetUp(Module module, Grammar grammar)
 {
     if (pattern == null)
     {
         string expression = "s('try' l(tryBody 0) 'catch' ?(s('(' l(catchVariable 1) ')')) l(catchBody 0))";
         Pattern[] parameters = {Statement.pattern, Expression.pattern};
     
         ParseGraphNode parseGraph = BootstrapParser.Parse(expression, parameters);
     
         pattern = new ConcretePattern(null, "TryStatement", parseGraph);
         pattern.SetType(typeof(TryStatement));
     
         Statement.pattern.AddAltPattern(pattern);
     }
     
     module.SetName("TryStatement", typeof(TryStatement));
     grammar.PatternDefined(pattern);
 }
 public new static void SetUp(Module module, Grammar grammar)
 {
     if (pattern == null)
     {
         string expression = "o((leftRecursive true) s(l(a 0) '>=' l(b 0)))";
         Pattern[] parameters = {Expression.pattern};
     
         ParseGraphNode parseGraph = BootstrapParser.Parse(expression, parameters);
 
         pattern = new ConcretePattern(null, "GreaterOrEqualExpression", parseGraph);
         pattern.SetType(typeof(GreaterOrEqualExpression));
     
         ComparisonExpression.pattern.AddAltPattern(pattern);
     }
     
     module.SetName("GreaterOrEqualExpression", typeof(GreaterOrEqualExpression));
     grammar.PatternDefined(pattern);
 }
Exemplo n.º 18
0
 public new static void SetUp(Module module, Grammar grammar)
 {
     if (pattern == null)
     {
         string expression = "o((leftRecursive true) s(l(obj 0) 'is' l(type 0)))";
         Pattern[] parameters = {Expression.pattern};
     
         ParseGraphNode parseGraph = BootstrapParser.Parse(expression, parameters);
 
         pattern = new ConcretePattern(null, "IsExpression", parseGraph);
         pattern.SetType(typeof(IsExpression));
     
         TypeExpression.pattern.AddAltPattern(pattern);
     }
     
     module.SetName("IsExpression", typeof(IsExpression));
     grammar.PatternDefined(pattern);
 }
Exemplo n.º 19
0
 public new static void SetUp(Module module, Grammar grammar)
 {
     if (pattern == null)
     {
         string expression = "s('if' '(' l(condition 0) ')' l(trueBody 1) ?(s('else' l(falseBody 1))))";
         Pattern[] parameters = {Expression.pattern, Statement.pattern};
         
         ParseGraphNode parseGraph = BootstrapParser.Parse(expression, parameters);
     
         pattern = new ConcretePattern(null, "IfStatement", parseGraph);
         pattern.SetType(typeof(IfStatement));
     
         Statement.pattern.AddAltPattern(pattern);
     }
     
     module.SetName("IfStatement", typeof(IfStatement));
     grammar.PatternDefined(pattern);
 }
Exemplo n.º 20
0
 public new static void SetUp(Module module, Grammar grammar)
 {
     if (pattern == null)
     {
         string expression = "o((rightRecursive true) s('&' l(body 0)))";
         Pattern[] patterns = {PatternExpression.pattern};
     
         ParseGraphNode parseGraph = BootstrapParser.Parse(expression, patterns);
 
         pattern = new ConcretePattern(null, "AndPatternExpression", parseGraph);
         pattern.SetType(typeof(AndPatternExpression));
     
         PatternExpression.pattern.AddAltPattern(pattern);
     }
     
     module.SetName("AndPatternExpression", typeof(AndPatternExpression));
     grammar.PatternDefined(pattern);
 }
Exemplo n.º 21
0
 public new static void SetUp(Module module, Grammar grammar)
 {
     if (pattern == null)
     {
         string expression = "s('field' l(name 0) ';')";
         Pattern[] patterns = {Name.pattern};
     
         ParseGraphNode parseGraph = BootstrapParser.Parse(expression, patterns);
 
         pattern = new ConcretePattern(null, "FieldMember", parseGraph);
         pattern.SetType(typeof(FieldMember));
     
         Member.pattern.AddAltPattern(pattern);
     }
     
     module.SetName("FieldMember", typeof(FieldMember));
     grammar.PatternDefined(pattern);
 }
Exemplo n.º 22
0
 public new static void SetUp(Module module, Grammar grammar)
 {
     if (pattern == null)
     {
         string expression = "o((leftRecursive true) s(l(callable 0) '(' o((dropPrecedence true) l(parameters ?(s(0 *(s(',' 0)))))) ')'))";
         Pattern[] parameters = {Expression.pattern};
     
         ParseGraphNode parseGraph = BootstrapParser.Parse(expression, parameters);
 
         pattern = new ConcretePattern(null, "CallExpression", parseGraph);
         pattern.SetType(typeof(CallExpression));
     
         Expression.pattern.AddAltPattern(pattern);
     }
     
     module.SetName("CallExpression", typeof(CallExpression));
     grammar.PatternDefined(pattern);
 }
Exemplo n.º 23
0
 public new static void SetUp(Module module, Grammar grammar)
 {
     if (pattern == null)
     {
         string expression = "s('throw' l(exception 0) ';')";
         Pattern[] parameters = {Expression.pattern};
     
         ParseGraphNode parseGraph = BootstrapParser.Parse(expression, parameters);
     
         pattern = new ConcretePattern(null, "ThrowStatement", parseGraph);
         pattern.SetType(typeof(ThrowStatement));
     
         Statement.pattern.AddAltPattern(pattern);
     }
     
     module.SetName("ThrowStatement", typeof(ThrowStatement));
     grammar.PatternDefined(pattern);
 }
 public new static void SetUp(Module module, Grammar grammar)
 {
     if (pattern == null)
     {
         string expression = "l(name a(0 1))";
         Pattern[] patterns = {MemberExpression.pattern, NameExpression.pattern};
     
         ParseGraphNode parseGraph = BootstrapParser.Parse(expression, patterns);
 
         pattern = new ConcretePattern(null, "ReferencePatternExpression", parseGraph);
         pattern.SetType(typeof(ReferencePatternExpression));
     
         PatternExpression.pattern.AddAltPattern(pattern);
     }
     
     module.SetName("ReferencePatternExpression", typeof(ReferencePatternExpression));
     grammar.PatternDefined(pattern);
 }
Exemplo n.º 25
0
 public new static void SetUp(Module module, Grammar grammar)
 {
     if (pattern == null)
     {
         string expression = "s('new' l(type o((exclude 1) 0)) '(' o((dropPrecedence true) l(parameters ?(s(0 *(s(',' 0)))))) ')')";
         Pattern[] parameters = {Expression.pattern, CallExpression.pattern};
     
         ParseGraphNode parseGraph = BootstrapParser.Parse(expression, parameters);
 
         pattern = new ConcretePattern(null, "NewExpression", parseGraph);
         pattern.SetType(typeof(NewExpression));
     
         Expression.pattern.AddAltPattern(pattern);
     }
     
     module.SetName("NewExpression", typeof(NewExpression));
     grammar.PatternDefined(pattern);
 }
Exemplo n.º 26
0
 public new static void SetUp(Module module, Grammar grammar)
 {
     if (pattern == null)
     {
         string expression = "l(name 0)";
         Pattern[] parameters = {Name.pattern};
     
         ParseGraphNode parseGraph = BootstrapParser.Parse(expression, parameters);
 
         pattern = new ConcretePattern(null, "NameExpression", parseGraph);
         pattern.SetType(typeof(NameExpression));
     
         Expression.pattern.AddAltPattern(pattern);
     }
     
     module.SetName("NameExpression", typeof(NameExpression));
     grammar.PatternDefined(pattern);
 }
Exemplo n.º 27
0
 public new static void SetUp(Module module, Grammar grammar)
 {
     if (pattern == null)
     {
         string expression = "s('(' o((dropPrecedence true) l(body 0)) ')')";
         Pattern[] parameters = {Expression.pattern};
     
         ParseGraphNode parseGraph = BootstrapParser.Parse(expression, parameters);
 
         pattern = new ConcretePattern(null, "ParenExpression", parseGraph);
         pattern.SetType(typeof(ParenExpression));
         
         Expression.pattern.AddAltPattern(pattern);
     }
     
     module.SetName("ParenExpression", typeof(ParenExpression));
     grammar.PatternDefined(pattern);
 }
Exemplo n.º 28
0
 public new static void SetUp(Module module, Grammar grammar)
 {
     if (pattern == null)
     {
         string expression = "s('{' l(body *(0)) '}')";
         Pattern[] patterns = {Statement.pattern};
     
         ParseGraphNode parseGraph = BootstrapParser.Parse(expression, patterns);
 
         pattern = new ConcretePattern(null, "CompoundStatement", parseGraph);
         pattern.SetType(typeof(CompoundStatement));
     
         Statement.pattern.AddAltPattern(pattern);
     }
     
     module.SetName("CompoundStatement", typeof(CompoundStatement));
     grammar.PatternDefined(pattern);
 }
Exemplo n.º 29
0
 public new static void SetUp(Module module, Grammar grammar)
 {
     if (pattern == null)
     {
         string expression = "s('token' l(body 0))";
         Pattern[] patterns = {BlockPatternExpression.pattern};
     
         ParseGraphNode parseGraph = BootstrapParser.Parse(expression, patterns);
 
         pattern = new ConcretePattern(null, "TokenPatternExpression", parseGraph);
         pattern.SetType(typeof(TokenPatternExpression));
     
         PatternExpression.pattern.AddAltPattern(pattern);
     }
     
     module.SetName("TokenPatternExpression", typeof(TokenPatternExpression));
     grammar.PatternDefined(pattern);
 }
Exemplo n.º 30
0
 public new static void SetUp(Module module, Grammar grammar)
 {
     if (pattern == null)
     {
         string expression = "o((leftRecursive true) s(l(body 0) l(reps o((buildTextNodes true) a('?' '*' '+')))))";
         Pattern[] patterns = {PatternExpression.pattern};
     
         ParseGraphNode parseGraph = BootstrapParser.Parse(expression, patterns);
 
         pattern = new ConcretePattern(null, "RepeatPatternExpression", parseGraph);
         pattern.SetType(typeof(RepeatPatternExpression));
     
         PatternExpression.pattern.AddAltPattern(pattern);
     }
     
     module.SetName("RepeatPatternExpression", typeof(RepeatPatternExpression));
     grammar.PatternDefined(pattern);
 }