From 30057bea6ad2ecd2d005f497831a5fea551c2ac9 Mon Sep 17 00:00:00 2001 From: Adrian Thurston Date: Fri, 29 Mar 2013 21:35:48 -0400 Subject: removed some labels that were there just for the location Don't need them now that the loc exported function searches. --- colm/colm.lm | 30 ++++++++++++++++-------------- colm/load.cc | 24 ++++++++++++------------ 2 files changed, 28 insertions(+), 26 deletions(-) diff --git a/colm/colm.lm b/colm/colm.lm index 43506e73..2ec1752d 100644 --- a/colm/colm.lm +++ b/colm/colm.lm @@ -299,7 +299,7 @@ def cfl_def ProdList: prod_list] def region_def - [L: LEX RootItemList: root_item* END] + [LEX RootItemList: root_item* END] def rl_def [RL Id: id LEX_FSLASH Expr: lex_expr LEX_FSLASH] @@ -309,8 +309,10 @@ def opt_lex_expr | [] def token_def - [TOKEN Id: id VarDefList: var_def* - NiLeft: opt_no_ignore LEX_FSLASH OptExpr: opt_lex_expr LEX_FSLASH NiRight: opt_no_ignore + [TOKEN Id: id VarDefList: var_def* + NiLeft: opt_no_ignore + LEX_FSLASH OptExpr: opt_lex_expr LEX_FSLASH + NiRight: opt_no_ignore OptTranslate: opt_translate] def opt_translate @@ -361,9 +363,9 @@ def statement BlockOrSingle: block_or_single] | [IF IfExpr: code_expr BlockOrSingle: block_or_single ElsifList: elsif_list] | [WHILE WhileExpr: code_expr BlockOrSingle: block_or_single] -| [LhsVarRef: var_ref E: EQUALS CodeExpr: code_expr] +| [LhsVarRef: var_ref EQUALS CodeExpr: code_expr] | [YIELD YieldVarRef: var_ref] -| [R: RETURN ReturnExpr: code_expr] +| [RETURN ReturnExpr: code_expr] | [Break: BREAK] | [Reject: REJECT] @@ -460,21 +462,21 @@ def code_factor OptFieldInit: opt_field_init Accumulate: accumulate] | [Cons: CONS OptCapture: opt_capture TypeRef: type_ref OptFieldInit: opt_field_init Constructor: constructor] -| [M: MATCH MatchVarRef: var_ref Pattern: pattern] +| [MATCH MatchVarRef: var_ref Pattern: pattern] | [String: cstring] | [TypeRef: type_ref IN InVarRef: var_ref] -| [M: MAKE_TREE POPEN MakeTreeExprList: code_expr* PCLOSE] -| [M: MAKE_TOKEN POPEN MakeTokenExprList: code_expr* PCLOSE] -| [T: TYPEID LT TypeIdTypeRef: type_ref GT] -| [N: NEW NewCodeFactor: code_factor] +| [MAKE_TREE POPEN MakeTreeExprList: code_expr* PCLOSE] +| [MAKE_TOKEN POPEN MakeTokenExprList: code_expr* PCLOSE] +| [TYPEID LT TypeIdTypeRef: type_ref GT] +| [NEW NewCodeFactor: code_factor] def type_ref [RegionQual: region_qual DirectId: id OptRepeat: opt_repeat] | [PTR RegionQual: region_qual PtrId: id OptRepeat: opt_repeat] -| [M: MAP LT MapKeyType: type_ref MapValueType: type_ref GT] -| [L: LIST LT ListType: type_ref GT] -| [V: VECTOR LT VectorType: type_ref GT] -| [P: PARSER LT ParserType: type_ref GT] +| [MAP LT MapKeyType: type_ref MapValueType: type_ref GT] +| [LIST LT ListType: type_ref GT] +| [VECTOR LT VectorType: type_ref GT] +| [PARSER LT ParserType: type_ref GT] def region_qual [RegionQual: region_qual Id: id DOUBLE_COLON] diff --git a/colm/load.cc b/colm/load.cc index 10f42e3c..720de4ae 100644 --- a/colm/load.cc +++ b/colm/load.cc @@ -236,7 +236,7 @@ struct LoadSource else if ( Statement.LhsVarRef() != 0 ) { LangVarRef *varRef = walkVarRef( Statement.LhsVarRef() ); LangExpr *expr = walkCodeExpr( Statement.CodeExpr() ); - stmt = LangStmt::cons( Statement.E().loc(), LangStmt::AssignType, varRef, expr ); + stmt = LangStmt::cons( varRef->loc, LangStmt::AssignType, varRef, expr ); } else if ( Statement.YieldVarRef() != 0 ) { LangVarRef *varRef = walkVarRef( Statement.YieldVarRef() ); @@ -244,7 +244,7 @@ struct LoadSource } else if ( Statement.ReturnExpr() != 0 ) { LangExpr *expr = walkCodeExpr( Statement.ReturnExpr() ); - stmt = LangStmt::cons( Statement.R().loc(), LangStmt::ReturnType, expr ); + stmt = LangStmt::cons( Statement.loc(), LangStmt::ReturnType, expr ); } else if ( Statement.Break() != 0 ) { stmt = LangStmt::cons( LangStmt::BreakType ); @@ -700,19 +700,19 @@ struct LoadSource else if ( typeRef.MapKeyType() != 0 ) { TypeRef *key = walkTypeRef( typeRef.MapKeyType() ); TypeRef *value = walkTypeRef( typeRef.MapValueType() ); - tr = TypeRef::cons( typeRef.M().loc(), TypeRef::Map, 0, key, value ); + tr = TypeRef::cons( typeRef.loc(), TypeRef::Map, 0, key, value ); } else if ( typeRef.ListType() != 0 ) { TypeRef *type = walkTypeRef( typeRef.ListType() ); - tr = TypeRef::cons( typeRef.L().loc(), TypeRef::List, 0, type, 0 ); + tr = TypeRef::cons( typeRef.loc(), TypeRef::List, 0, type, 0 ); } else if ( typeRef.VectorType() != 0 ) { TypeRef *type = walkTypeRef( typeRef.VectorType() ); - tr = TypeRef::cons( typeRef.V().loc(), TypeRef::Vector, 0, type, 0 ); + tr = TypeRef::cons( typeRef.loc(), TypeRef::Vector, 0, type, 0 ); } else if ( typeRef.ParserType() != 0 ) { TypeRef *type = walkTypeRef( typeRef.ParserType() ); - tr = TypeRef::cons( typeRef.P().loc(), TypeRef::Parser, 0, type, 0 ); + tr = TypeRef::cons( typeRef.loc(), TypeRef::Parser, 0, type, 0 ); } return tr; } @@ -956,7 +956,7 @@ struct LoadSource void walkLexRegion( region_def regionDef ) { - pushRegionSet( regionDef.L().loc() ); + pushRegionSet( regionDef.loc() ); walkRootItemList( regionDef.RootItemList() ); popRegionSet(); } @@ -1472,7 +1472,7 @@ struct LoadSource else if ( codeFactor.MatchVarRef() != 0 ) { LangVarRef *varRef = walkVarRef( codeFactor.MatchVarRef() ); PatternItemList *list = walkPattern( codeFactor.Pattern() ); - expr = match( codeFactor.M().loc(), varRef, list ); + expr = match( codeFactor.loc(), varRef, list ); } else if ( codeFactor.InVarRef() != 0 ) { TypeRef *typeRef = walkTypeRef( codeFactor.TypeRef() ); @@ -1482,22 +1482,22 @@ struct LoadSource } else if ( codeFactor.MakeTreeExprList() != 0 ) { ExprVect *exprList = walkCodeExprList( codeFactor.MakeTreeExprList() ); - expr = LangExpr::cons( LangTerm::cons( codeFactor.M().loc(), + expr = LangExpr::cons( LangTerm::cons( codeFactor.loc(), LangTerm::MakeTreeType, exprList ) ); } else if ( codeFactor.MakeTokenExprList() != 0 ) { ExprVect *exprList = walkCodeExprList( codeFactor.MakeTokenExprList() ); - expr = LangExpr::cons( LangTerm::cons( codeFactor.M().loc(), + expr = LangExpr::cons( LangTerm::cons( codeFactor.loc(), LangTerm::MakeTokenType, exprList ) ); } else if ( codeFactor.TypeIdTypeRef() != 0 ) { TypeRef *typeRef = walkTypeRef( codeFactor.TypeIdTypeRef() ); - expr = LangExpr::cons( LangTerm::cons( codeFactor.T().loc(), + expr = LangExpr::cons( LangTerm::cons( codeFactor.loc(), LangTerm::TypeIdType, typeRef ) ); } else if ( codeFactor.NewCodeFactor() != 0 ) { LangExpr *newExpr = walkCodeFactor( codeFactor.NewCodeFactor() ); - expr = LangExpr::cons( LangTerm::cons( codeFactor.N().loc(), + expr = LangExpr::cons( LangTerm::cons( codeFactor.loc(), LangTerm::NewType, newExpr ) ); } return expr; -- cgit v1.2.1