summaryrefslogtreecommitdiff
path: root/colm/load.cc
diff options
context:
space:
mode:
authorAdrian Thurston <thurston@complang.org>2013-03-22 18:31:55 -0400
committerAdrian Thurston <thurston@complang.org>2013-03-22 18:31:55 -0400
commit451bf1904630d951c679f68473b378317370383c (patch)
tree5e409c3365dbd7d79c886b1727d32304f0fd3c73 /colm/load.cc
parente3711e90254c1310e5669f3fecd682be97a037e9 (diff)
downloadcolm-451bf1904630d951c679f68473b378317370383c.tar.gz
hid the implementation of LoadSource
Diffstat (limited to 'colm/load.cc')
-rw-r--r--colm/load.cc111
1 files changed, 111 insertions, 0 deletions
diff --git a/colm/load.cc b/colm/load.cc
index 3dc92f27..4492f992 100644
--- a/colm/load.cc
+++ b/colm/load.cc
@@ -35,6 +35,115 @@
extern RuntimeData main_runtimeData;
+struct LoadSource
+:
+ public BaseParser
+{
+ LoadSource( Compiler *pd, const char *inputFileName )
+ :
+ BaseParser( pd ),
+ inputFileName( inputFileName )
+ {}
+
+ const char *inputFileName;
+
+ void go();
+
+ ObjectField *walkVarDef( var_def varDef );
+ NamespaceQual *walkRegionQual( region_qual regionQual );
+ RepeatType walkOptRepeat( opt_repeat OptRepeat );
+ TypeRef *walkTypeRef( type_ref typeRef );
+
+ ReOrItem *walkRegOrChar( reg_or_char regOrChar );
+ ReOrBlock *walkRegOrData( reg_or_data regOrData );
+
+ LexFactor *walkLexFactor( lex_factor &LexFactorTree );
+ LexFactorNeg *walkLexFactorNeg( lex_factor_neg &LexFactorNegTree );
+ LexFactorRep *walkLexFactorRep( lex_factor_rep &LexFactorRepTree );
+ LexFactorAug *walkLexFactorAug( lex_factor_rep &LexFactorRepTree );
+ LexTerm *walkLexTerm( lex_term &LexTerm );
+ LexExpression *walkLexExpr( lex_expr &LexExpr );
+ ExprVect *walkCodeExprList( _repeat_code_expr codeExprList );
+ LangExpr *walkCodeExpr( code_expr codeExpr );
+ void walkLexRegion( region_def regionDef );
+ void walkProdElList( ProdElList *list, prod_el_list ProdElList );
+ void walkProdList( LelDefList *lelDefList, prod_list &ProdList );
+ void walkCflDef( cfl_def cflDef );
+ LangTerm *walkIterCall( iter_call IterCall );
+ LangStmt *walkOptionalElse( optional_else optionalElse );
+ LangStmt *walkElsifClause( elsif_clause elsifClause );
+ LangStmt *walkElsifList( elsif_list elsifList );
+ LangStmt *walkStatement( statement Statement );
+ LangStmt *walkPrintStmt( print_stmt &PrintStmt );
+ LangExpr *walkCodeUnary( code_unary codeUnary );
+ LangExpr *walkCodeFactor( code_factor codeFactor );
+ LangStmt *walkExprStmt( expr_stmt &ExprStmt );
+ QualItemVect *walkQual( qual &Qual );
+ LangVarRef *walkVarRef( var_ref varRef );
+ void walkRootItem( root_item &rootItem, StmtList *stmtList );
+ StmtList *walkRootItemList( _repeat_root_item rootItemList );
+ void walkNamespaceDef( namespace_def NamespaceDef );
+ StmtList *walkLangStmtList( lang_stmt_list LangStmtList );
+ StmtList *walkBlockOrSingle( block_or_single blockOrSingle );
+
+ void walkLiteralItem( literal_item literalItem );
+ void walkLiteralList( literal_list literalList );
+ void walkLiteralDef( literal_def literalDef );
+
+ void walkTokenDef( token_def TokenDef );
+ void walkIgnoreDef( ignore_def IgnoreDef );
+ void walkContextDef( context_def contextDef );
+ void walkContextItem( context_item contextItem );
+ void walkContextVarDef( context_var_def contextVarDef );
+ CodeBlock *walkOptReduce( opt_reduce optReduce );
+
+ void walkFieldInit( FieldInitVect *list, field_init fieldInit );
+ FieldInitVect *walkOptFieldInit( opt_field_init optFieldInit );
+
+ ConsItemList *walkLitAccumEl( lit_accum_el litAccumEl );
+ ConsItemList *walkLitAccumElList( _repeat_lit_accum_el litAccumElList );
+ ConsItemList *walkAccumTopEl( accum_top_el accumTopEl );
+ ConsItemList *walkAccumList( accum_list accumList );
+ ConsItemList *walkAccumulate( accumulate Accumulate );
+ ConsItemList *walkAccumEl( accum_el accumEl );
+ ConsItemList *walkAccumElList( _repeat_accum_el accumElList );
+
+ void walkRlDef( rl_def RlDef );
+
+ ConsItemList *walkLitConsEl( lit_cons_el litConsEl );
+ ConsItemList *walkLitConsElList( _repeat_lit_cons_el litConsElList );
+ ConsItemList *walkConsTopEl( cons_top_el consTopEl );
+ ConsItemList *walkConsList( cons_list consList );
+ ConsItemList *walkConstructor( constructor Constructor );
+ ConsItemList *walkConsEl( cons_el consEl );
+ ConsItemList *walkConsElList( _repeat_cons_el consElList );
+
+ LangExpr *walkCodeRelational( code_relational codeRelational );
+ LangExpr *walkCodeAdditive( code_additive codeAdditive );
+ LangExpr *walkCodeMultiplicitive( code_multiplicitive codeMultiplicitive );
+
+ ConsItemList *walkLitStringEl( lit_string_el litStringEl );
+ ConsItemList *walkLitStringElList( _repeat_lit_string_el litStringElList );
+ ConsItemList *walkStringTopEl( string_top_el stringTopEl );
+ ConsItemList *walkStringList( string_list stringList );
+ ConsItemList *walkString( cstring String );
+ ConsItemList *walkStringEl( string_el stringEl );
+ ConsItemList *walkStringElList( _repeat_string_el stringElList );
+ void walkFunctionDef( function_def functionDef );
+
+ TypeRef *walkReferenceTypeRef( reference_type_ref ReferenceTypeRef );
+ ObjectField *walkParamVarDef( param_var_def ParamVarDef );
+ ParameterList *walkParamVarDefList( _repeat_param_var_def ParamVarDefList );
+ void walkIterDef( iter_def IterDef );
+};
+
+
+BaseParser *consLoadSource( Compiler *pd, const char *inputFileName )
+{
+ return new LoadSource( pd, inputFileName );
+}
+
+
String unescape( const String &s )
{
String out( String::Fresh(), s.length() );
@@ -1258,6 +1367,8 @@ StmtList *LoadSource::walkRootItemList( _repeat_root_item rootItemList )
void LoadSource::go()
{
+ LoadSource::init();
+
const char *argv[2];
argv[0] = inputFileName;
argv[1] = 0;