public Expression Serialize(QuasiquoteExpression node) { Expression e = Serialize(node.Node); if (_stack.Count != 0) { throw new InvalidOperationException(); } return(e); }
override public object Clone() { QuasiquoteExpression clone = (QuasiquoteExpression)FormatterServices.GetUninitializedObject(typeof(QuasiquoteExpression)); clone._lexicalInfo = _lexicalInfo; clone._endSourceLocation = _endSourceLocation; clone._documentation = _documentation; clone._entity = _entity; if (_annotations != null) { clone._annotations = (Hashtable)_annotations.Clone(); } clone._expressionType = _expressionType; if (null != _node) { clone._node = _node.Clone() as Node; clone._node.InitializeParent(clone); } return(clone); }
override public object Clone() { QuasiquoteExpression clone = new QuasiquoteExpression(); clone._lexicalInfo = _lexicalInfo; clone._endSourceLocation = _endSourceLocation; clone._documentation = _documentation; clone._isSynthetic = _isSynthetic; clone._entity = _entity; if (_annotations != null) { clone._annotations = (Hashtable)_annotations.Clone(); } clone._expressionType = _expressionType; if (null != _node) { clone._node = _node.Clone() as Node; clone._node.InitializeParent(clone); } return(clone); }
public override void OnQuasiquoteExpression(Boo.Lang.Compiler.Ast.QuasiquoteExpression node) { // ignore quasi-quotes }
//throws RecognitionException, TokenStreamException public QuasiquoteExpression ast_literal_expression() { QuasiquoteExpression e; IToken begin = null; IToken end = null; Node node = null; e = null; try { // for error handling begin = LT(1); match(QQ_BEGIN); if (0==inputState.guessing) { e = new QuasiquoteExpression(SourceLocationFactory.ToLexicalInfo(begin)); } { bool synPredMatched394 = false; if (((tokenSet_4_.member(LA(1))) && (tokenSet_69_.member(LA(2))))) { int _m394 = mark(); synPredMatched394 = true; inputState.guessing++; try { { expression(); match(QQ_END); } } catch (RecognitionException) { synPredMatched394 = false; } rewind(_m394); inputState.guessing--; } if ( synPredMatched394 ) { node=expression(); if (0==inputState.guessing) { e.Node = node; } } else if ((tokenSet_100_.member(LA(1))) && (tokenSet_2_.member(LA(2)))) { { { if ((LA(1)==EOF||LA(1)==EOS||LA(1)==NEWLINE) && (tokenSet_100_.member(LA(2)))) { eos(); } else if ((tokenSet_100_.member(LA(1))) && (tokenSet_2_.member(LA(2)))) { } else { throw new NoViableAltException(LT(1), getFilename()); } } ast_literal_block(e); } } else { throw new NoViableAltException(LT(1), getFilename()); } } end = LT(1); match(QQ_END); if (0==inputState.guessing) { e.EndSourceLocation = SourceLocationFactory.ToSourceLocation(end); } } catch (RecognitionException ex) { if (0 == inputState.guessing) { reportError(ex); recover(ex,tokenSet_36_); } else { throw ex; } } return e; }
public override void OnQuasiquoteExpression(QuasiquoteExpression node) { Visit(node.Node); CodeSerializer serializer = new CodeSerializer(); ReplaceCurrentNode(serializer.Serialize(node)); }
//throws RecognitionException, TokenStreamException public void ast_literal_module( QuasiquoteExpression e ) { Module m = NewQuasiquoteModule(e.LexicalInfo); e.Node = m; try { // for error handling parse_module(m); } catch (RecognitionException ex) { if (0 == inputState.guessing) { reportError(ex); recover(ex,tokenSet_50_); } else { throw ex; } } }
public void ast_literal_closure( QuasiquoteExpression e ) //throws RecognitionException, TokenStreamException { IToken c = null; Block block = null; Node node = null; try { // for error handling bool synPredMatched475 = false; if (((tokenSet_5_.member(LA(1))) && (tokenSet_113_.member(LA(2))))) { int _m475 = mark(); synPredMatched475 = true; inputState.guessing++; try { { expression(); { switch ( LA(1) ) { case COLON: { match(COLON); break; } case QQ_END: { match(QQ_END); break; } default: { throw new NoViableAltException(LT(1), getFilename()); } } } } } catch (RecognitionException) { synPredMatched475 = false; } rewind(_m475); inputState.guessing--; } if ( synPredMatched475 ) { { node=expression(); if (0==inputState.guessing) { e.Node = node; } { switch ( LA(1) ) { case COLON: { c = LT(1); match(COLON); node=expression(); if (0==inputState.guessing) { e.Node = new ExpressionPair(ToLexicalInfo(c), (Expression)e.Node, (Expression)node); } break; } case QQ_END: { break; } default: { throw new NoViableAltException(LT(1), getFilename()); } } } } } else if ((LA(1)==IMPORT)) { { node=import_directive_(); if (0==inputState.guessing) { e.Node = node; } } } else if ((tokenSet_104_.member(LA(1))) && (tokenSet_101_.member(LA(2)))) { { if (0==inputState.guessing) { block = new Block(); } internal_closure_stmt(block); { // ( ... )* for (;;) { if ((LA(1)==EOL||LA(1)==EOS)) { eos(); { switch ( LA(1) ) { case ESEPARATOR: case CAST: case CHAR: case FALSE: case NOT: case NULL: case RAISE: case RETURN: case SELF: case SUPER: case THEN: case TRUE: case TYPEOF: case YIELD: case TRIPLE_QUOTED_STRING: case LPAREN: case DOUBLE_QUOTED_STRING: case SINGLE_QUOTED_STRING: case ID: case MULTIPLY: case LBRACK: case COMMA: case SPLICE_BEGIN: case DOT: case LBRACE: case QQ_BEGIN: case SUBTRACT: case LONG: case INCREMENT: case DECREMENT: case ONES_COMPLEMENT: case INT: case BACKTICK_QUOTED_STRING: case RE_LITERAL: case DOUBLE: case FLOAT: case TIMESPAN: { internal_closure_stmt(block); break; } case EOL: case EOS: case QQ_END: { break; } default: { throw new NoViableAltException(LT(1), getFilename()); } } } } else { goto _loop482_breakloop; } } _loop482_breakloop: ; } // ( ... )* if (0==inputState.guessing) { e.Node = block; if (block.Statements.Count == 1) { e.Node = block.Statements[0]; } } } } else { throw new NoViableAltException(LT(1), getFilename()); } } catch (RecognitionException ex) { if (0 == inputState.guessing) { reportError(ex, "ast_literal_closure"); recover(ex,tokenSet_114_); } else { throw ex; } } }
//throws RecognitionException, TokenStreamException public void ast_literal_block( QuasiquoteExpression e ) { // TODO: either cache or construct these objects on demand TypeMemberCollection collection = new TypeMemberCollection(); Block block = new Block(); StatementCollection statements = block.Statements; Node node = null; try { // for error handling bool synPredMatched381 = false; if (((tokenSet_22_.member(LA(1))) && (tokenSet_90_.member(LA(2))))) { int _m381 = mark(); synPredMatched381 = true; inputState.guessing++; try { { type_definition_member_prediction(); } } catch (RecognitionException) { synPredMatched381 = false; } rewind(_m381); inputState.guessing--; } if ( synPredMatched381 ) { { type_definition_member(collection); if (0==inputState.guessing) { e.Node = collection[0]; } } } else if ((tokenSet_14_.member(LA(1))) && (tokenSet_13_.member(LA(2)))) { { { // ( ... )+ int _cnt385=0; for (;;) { if ((tokenSet_14_.member(LA(1)))) { stmt(statements); } else { if (_cnt385 >= 1) { goto _loop385_breakloop; } else { throw new NoViableAltException(LT(1), getFilename());; } } _cnt385++; } _loop385_breakloop: ; } // ( ... )+ if (0==inputState.guessing) { if (block.Statements.Count > 0) { e.Node = block.Statements.Count > 1 ? block : block.Statements[0]; } } } } else { throw new NoViableAltException(LT(1), getFilename()); } } catch (RecognitionException ex) { if (0 == inputState.guessing) { reportError(ex); recover(ex,tokenSet_91_); } else { throw ex; } } }
override public void OnQuasiquoteExpression(QuasiquoteExpression node) { var serializer = new CodeSerializer(_preserveLexicalInfo); ReplaceCurrentNode(serializer.Serialize(node)); }
public override void OnQuasiquoteExpression(QuasiquoteExpression node) { _expression = new CodeObjectCreateExpression(node.Node.GetType()); }
override public object Clone() { QuasiquoteExpression clone = new QuasiquoteExpression(); clone._lexicalInfo = _lexicalInfo; clone._endSourceLocation = _endSourceLocation; clone._documentation = _documentation; clone._isSynthetic = _isSynthetic; clone._entity = _entity; if (_annotations != null) clone._annotations = (Hashtable)_annotations.Clone(); clone._expressionType = _expressionType; if (null != _node) { clone._node = _node.Clone() as Node; clone._node.InitializeParent(clone); } return clone; }
public override void OnQuasiquoteExpression(QuasiquoteExpression e) { WriteIndentedOperator("[|"); if (e.Node is Expression) { Write(" "); Visit(e.Node); Write(" "); WriteIndentedOperator("|]"); } else { WriteLine(); Indent(); Visit(e.Node); Dedent(); WriteIndentedOperator("|]"); WriteLine(); } }
public QuasiquoteExpression ast_literal_expression() //throws RecognitionException, TokenStreamException { QuasiquoteExpression e; IToken begin = null; IToken end = null; e = null; try { // for error handling begin = LT(1); match(QQ_BEGIN); if (0==inputState.guessing) { e = new QuasiquoteExpression(ToLexicalInfo(begin)); } { switch ( LA(1) ) { case INDENT: { { match(INDENT); ast_literal_block(e); match(DEDENT); { switch ( LA(1) ) { case EOL: case EOS: { eos(); break; } case QQ_END: { break; } default: { throw new NoViableAltException(LT(1), getFilename()); } } } } break; } case ESEPARATOR: case CAST: case CHAR: case FALSE: case IMPORT: case NOT: case NULL: case RAISE: case RETURN: case SELF: case SUPER: case THEN: case TRUE: case TYPEOF: case YIELD: case TRIPLE_QUOTED_STRING: case LPAREN: case DOUBLE_QUOTED_STRING: case SINGLE_QUOTED_STRING: case ID: case MULTIPLY: case LBRACK: case COMMA: case SPLICE_BEGIN: case DOT: case LBRACE: case QQ_BEGIN: case SUBTRACT: case LONG: case INCREMENT: case DECREMENT: case ONES_COMPLEMENT: case INT: case BACKTICK_QUOTED_STRING: case RE_LITERAL: case DOUBLE: case FLOAT: case TIMESPAN: { ast_literal_closure(e); break; } default: { throw new NoViableAltException(LT(1), getFilename()); } } } end = LT(1); match(QQ_END); if (0==inputState.guessing) { SetEndSourceLocation(e, end); } } catch (RecognitionException ex) { if (0 == inputState.guessing) { reportError(ex, "ast_literal_expression"); recover(ex,tokenSet_44_); } else { throw ex; } } return e; }
//throws RecognitionException, TokenStreamException public QuasiquoteExpression ast_literal_expression() { QuasiquoteExpression e; IToken begin = null; IToken end = null; Node node = null; e = null; try { // for error handling begin = LT(1); match(QQ_BEGIN); if (0==inputState.guessing) { e = new QuasiquoteExpression(SourceLocationFactory.ToLexicalInfo(begin)); } { bool synPredMatched372 = false; if (((tokenSet_59_.member(LA(1))) && (tokenSet_87_.member(LA(2))))) { int _m372 = mark(); synPredMatched372 = true; inputState.guessing++; try { { expression(); match(QQ_END); } } catch (RecognitionException) { synPredMatched372 = false; } rewind(_m372); inputState.guessing--; } if ( synPredMatched372 ) { node=expression(); if (0==inputState.guessing) { e.Node = node; } } else if ((tokenSet_88_.member(LA(1))) && (tokenSet_89_.member(LA(2)))) { { { switch ( LA(1) ) { case EOF: case EOS: case NEWLINE: { eos(); break; } case ESEPARATOR: case ABSTRACT: case BREAK: case CONTINUE: case CALLABLE: case CAST: case CHAR: case CLASS: case DEF: case ENUM: case EVENT: case FINAL: case FOR: case FALSE: case GOTO: case INTERFACE: case INTERNAL: case IF: case NULL: case OVERRIDE: case PUBLIC: case PROTECTED: case PRIVATE: case RAISE: case RETURN: case SELF: case SUPER: case STATIC: case STRUCT: case TRY: case TRANSIENT: case TRUE: case TYPEOF: case UNLESS: case VIRTUAL: case PARTIAL: case WHILE: case YIELD: case TRIPLE_QUOTED_STRING: case DOUBLE_QUOTED_STRING: case SINGLE_QUOTED_STRING: case ID: case LBRACK: case LPAREN: case SUBTRACT: case COLON: case SPLICE_BEGIN: case LBRACE: case QQ_BEGIN: case INCREMENT: case DECREMENT: case ONES_COMPLEMENT: case INT: case LONG: case RE_LITERAL: case DOUBLE: case FLOAT: case TIMESPAN: { break; } default: { throw new NoViableAltException(LT(1), getFilename()); } } } ast_literal_block(e); } } else { throw new NoViableAltException(LT(1), getFilename()); } } end = LT(1); match(QQ_END); if (0==inputState.guessing) { e.EndSourceLocation = SourceLocationFactory.ToSourceLocation(end); } } catch (RecognitionException ex) { if (0 == inputState.guessing) { reportError(ex); recover(ex,tokenSet_27_); } else { throw ex; } } return e; }
public void ast_literal_block( QuasiquoteExpression e ) //throws RecognitionException, TokenStreamException { // TODO: either cache or construct these objects on demand TypeMemberCollection collection = new TypeMemberCollection(); Block b = new Block(); StatementCollection statements = b.Statements; Node node = null; try { // for error handling bool synPredMatched453 = false; if (((tokenSet_110_.member(LA(1))) && (tokenSet_111_.member(LA(2))))) { int _m453 = mark(); synPredMatched453 = true; inputState.guessing++; try { { ast_literal_module_prediction(); } } catch (RecognitionException) { synPredMatched453 = false; } rewind(_m453); inputState.guessing--; } if ( synPredMatched453 ) { { ast_literal_module(e); } } else { bool synPredMatched463 = false; if (((tokenSet_38_.member(LA(1))) && (tokenSet_39_.member(LA(2))))) { int _m463 = mark(); synPredMatched463 = true; inputState.guessing++; try { { attributes(); { if ((tokenSet_31_.member(LA(1))) && (true)) { type_member_modifier(); } else if ((tokenSet_112_.member(LA(1))) && (true)) { { modifiers(); { switch ( LA(1) ) { case CLASS: { match(CLASS); break; } case ENUM: { match(ENUM); break; } case STRUCT: { match(STRUCT); break; } case INTERFACE: { match(INTERFACE); break; } case EVENT: { match(EVENT); break; } case DEF: { match(DEF); break; } case CALLABLE: { match(CALLABLE); break; } case ID: case SPLICE_BEGIN: { { { switch ( LA(1) ) { case ID: { match(ID); break; } case SPLICE_BEGIN: { splice_expression(); break; } default: { throw new NoViableAltException(LT(1), getFilename()); } } } { switch ( LA(1) ) { case AS: { match(AS); type_reference(); break; } case COLON: { break; } default: { throw new NoViableAltException(LT(1), getFilename()); } } } begin_with_doc(null); { switch ( LA(1) ) { case GET: { match(GET); break; } case SET: { match(SET); break; } default: { throw new NoViableAltException(LT(1), getFilename()); } } } } break; } default: { throw new NoViableAltException(LT(1), getFilename()); } } } } } else { throw new NoViableAltException(LT(1), getFilename()); } } } } catch (RecognitionException) { synPredMatched463 = false; } rewind(_m463); inputState.guessing--; } if ( synPredMatched463 ) { { { // ( ... )+ int _cnt466=0; for (;;) { if ((tokenSet_38_.member(LA(1)))) { type_definition_member(collection); } else { if (_cnt466 >= 1) { goto _loop466_breakloop; } else { throw new NoViableAltException(LT(1), getFilename());; } } _cnt466++; } _loop466_breakloop: ; } // ( ... )+ if (0==inputState.guessing) { if (collection.Count == 1) { e.Node = collection[0]; } else { Module m = CodeFactory.NewQuasiquoteModule(e.LexicalInfo); m.Members = collection; e.Node = m; } } } } else if ((tokenSet_17_.member(LA(1))) && (tokenSet_91_.member(LA(2)))) { { // ( ... )+ int _cnt468=0; for (;;) { if ((tokenSet_17_.member(LA(1)))) { stmt(statements); } else { if (_cnt468 >= 1) { goto _loop468_breakloop; } else { throw new NoViableAltException(LT(1), getFilename());; } } _cnt468++; } _loop468_breakloop: ; } // ( ... )+ if (0==inputState.guessing) { e.Node = b.Statements.Count > 1 ? b : b.Statements[0]; } } else { throw new NoViableAltException(LT(1), getFilename()); } } } catch (RecognitionException ex) { if (0 == inputState.guessing) { reportError(ex, "ast_literal_block"); recover(ex,tokenSet_67_); } else { throw ex; } } }
public override void OnQuasiquoteExpression(QuasiquoteExpression node) { // ignore quasi-quotes }
public void ast_literal_module( QuasiquoteExpression e ) //throws RecognitionException, TokenStreamException { var m = CodeFactory.NewQuasiquoteModule(e.LexicalInfo); e.Node = m; try { // for error handling parse_module(m); } catch (RecognitionException ex) { if (0 == inputState.guessing) { reportError(ex, "ast_literal_module"); recover(ex,tokenSet_67_); } else { throw ex; } } }
//throws RecognitionException, TokenStreamException public void ast_literal_block( QuasiquoteExpression e ) { // TODO: either cache or construct these objects on demand TypeMemberCollection collection = new TypeMemberCollection(); Block block = new Block(); StatementCollection statements = block.Statements; Node node = null; try { // for error handling bool synPredMatched420 = false; if (((tokenSet_22_.member(LA(1))) && (tokenSet_96_.member(LA(2))))) { int _m420 = mark(); synPredMatched420 = true; inputState.guessing++; try { { type_definition_member_prediction(); } } catch (RecognitionException) { synPredMatched420 = false; } rewind(_m420); inputState.guessing--; } if ( synPredMatched420 ) { { { // ( ... )+ int _cnt423=0; for (;;) { if ((tokenSet_22_.member(LA(1)))) { type_definition_member(collection); } else { if (_cnt423 >= 1) { goto _loop423_breakloop; } else { throw new NoViableAltException(LT(1), getFilename());; } } _cnt423++; } _loop423_breakloop: ; } // ( ... )+ if (0==inputState.guessing) { if (collection.Count == 1) { e.Node = collection[0]; } else { Module m = NewQuasiquoteModule(e.LexicalInfo); m.Members = collection; e.Node = m; } } } } else { bool synPredMatched425 = false; if (((tokenSet_97_.member(LA(1))) && (tokenSet_98_.member(LA(2))))) { int _m425 = mark(); synPredMatched425 = true; inputState.guessing++; try { { ast_literal_module_prediction(); } } catch (RecognitionException) { synPredMatched425 = false; } rewind(_m425); inputState.guessing--; } if ( synPredMatched425 ) { { ast_literal_module(e); } } else if ((tokenSet_12_.member(LA(1))) && (tokenSet_99_.member(LA(2)))) { { { // ( ... )+ int _cnt429=0; for (;;) { if ((tokenSet_12_.member(LA(1)))) { stmt(statements); } else { if (_cnt429 >= 1) { goto _loop429_breakloop; } else { throw new NoViableAltException(LT(1), getFilename());; } } _cnt429++; } _loop429_breakloop: ; } // ( ... )+ if (0==inputState.guessing) { e.Node = block.Statements.Count > 1 ? block : block.Statements[0]; } } } else { throw new NoViableAltException(LT(1), getFilename()); } } } catch (RecognitionException ex) { if (0 == inputState.guessing) { reportError(ex); recover(ex,tokenSet_50_); } else { throw ex; } } }