diff options
-rw-r--r-- | colm/colm.lm | 7 | ||||
-rw-r--r-- | colm/load.cc | 11 | ||||
-rw-r--r-- | colm/load.h | 2 |
3 files changed, 17 insertions, 3 deletions
diff --git a/colm/colm.lm b/colm/colm.lm index 27996aa9..74a64cd7 100644 --- a/colm/colm.lm +++ b/colm/colm.lm @@ -127,8 +127,8 @@ def root_item #| [typedef] def context_item -# [context_var_def] - [LiteralDef: literal_def] + [ContextVarDef: context_var_def] +| [LiteralDef: literal_def] #| [rl_def] | [TokenDef: token_def] | [IgnoreDef: ignore_def] @@ -141,6 +141,9 @@ def context_item #| [pre_eof] #| [precedence] +def context_var_def + [VarDef: var_def] + def context_def [CONTEXT Name: id ContextItemList: context_item* END] diff --git a/colm/load.cc b/colm/load.cc index 298e04ee..bf51e0be 100644 --- a/colm/load.cc +++ b/colm/load.cc @@ -650,9 +650,18 @@ LangStmt *LoadSource::walkStatement( statement Statement ) return stmt; } +void LoadSource::walkContextVarDef( context_var_def ContextVarDef ) +{ + ObjectField *objField = walkVarDef( ContextVarDef.VarDef() ); + contextVarDef( internal, objField ); +} + void LoadSource::walkContextItem( context_item contextItem ) { - if ( contextItem.TokenDef() != 0 ) { + if ( contextItem.ContextVarDef() != 0 ) { + walkContextVarDef( contextItem.ContextVarDef() ); + } + else if ( contextItem.TokenDef() != 0 ) { walkTokenDef( contextItem.TokenDef() ); } else if ( contextItem.IgnoreDef() != 0 ) { diff --git a/colm/load.h b/colm/load.h index d75c2b21..8ea2e85a 100644 --- a/colm/load.h +++ b/colm/load.h @@ -65,6 +65,7 @@ struct token_def; struct ignore_def; struct context_def; struct context_item; +struct context_var_def; struct LoadSource : @@ -123,6 +124,7 @@ struct LoadSource void walkIgnoreDef( ignore_def IgnoreDef ); void walkContextDef( context_def contextDef ); void walkContextItem( context_item contextItem ); + void walkContextVarDef( context_var_def contextVarDef ); void go(); }; |