summaryrefslogtreecommitdiff
path: root/ragel/host-d
diff options
context:
space:
mode:
Diffstat (limited to 'ragel/host-d')
-rw-r--r--ragel/host-d/.gitignore13
-rw-r--r--ragel/host-d/CMakeLists.txt34
-rw-r--r--ragel/host-d/Makefile.am32
-rw-r--r--ragel/host-d/main.cc72
-rw-r--r--ragel/host-d/rlhc.lm511
-rw-r--r--ragel/host-d/rlparse.lm211
6 files changed, 0 insertions, 873 deletions
diff --git a/ragel/host-d/.gitignore b/ragel/host-d/.gitignore
deleted file mode 100644
index 353df34b..00000000
--- a/ragel/host-d/.gitignore
+++ /dev/null
@@ -1,13 +0,0 @@
-/Makefile
-/Makefile.in
-/.deps
-/.libs
-/ragel-d
-/ragel-d.exe
-/rlhc.c
-/rlparse.pack
-/rlparse.c
-/rlreduce.cc
-
-/CMakeFiles
-/cmake_install.cmake
diff --git a/ragel/host-d/CMakeLists.txt b/ragel/host-d/CMakeLists.txt
deleted file mode 100644
index c302fabc..00000000
--- a/ragel/host-d/CMakeLists.txt
+++ /dev/null
@@ -1,34 +0,0 @@
-add_custom_command(OUTPUT
- "${CMAKE_CURRENT_BINARY_DIR}/rlparse.c"
- "${CMAKE_CURRENT_BINARY_DIR}/rlreduce.cc"
- DEPENDS rlparse.lm
- COMMAND colm::colm
- ARGS -I.. -c -b rlparseD
- -o "${CMAKE_CURRENT_BINARY_DIR}/rlparse.c"
- -m "${CMAKE_CURRENT_BINARY_DIR}/rlreduce.cc"
- rlparse.lm
- WORKING_DIRECTORY "${CMAKE_CURRENT_LIST_DIR}")
-
-add_custom_command(OUTPUT
- "${CMAKE_CURRENT_BINARY_DIR}/rlhc.c"
- DEPENDS rlhc.lm
- COMMAND colm::colm
- ARGS -I.. -c -b rlhcD
- -o "${CMAKE_CURRENT_BINARY_DIR}/rlhc.c"
- rlhc.lm
- WORKING_DIRECTORY "${CMAKE_CURRENT_LIST_DIR}")
-
-add_executable(ragel-d main.cc
- "${CMAKE_CURRENT_BINARY_DIR}/rlhc.c"
- "${CMAKE_CURRENT_BINARY_DIR}/rlparse.c"
- "${CMAKE_CURRENT_BINARY_DIR}/rlreduce.cc")
-
-target_link_libraries(ragel-d PRIVATE libragel libfsm)
-
-if(${PROJECT_NAME}_MAKE_INSTALL)
- install(TARGETS ragel-d
- EXPORT ${_PACKAGE_NAME}-targets
- RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}"
- LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}"
- ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}")
-endif()
diff --git a/ragel/host-d/Makefile.am b/ragel/host-d/Makefile.am
deleted file mode 100644
index aae8d6fe..00000000
--- a/ragel/host-d/Makefile.am
+++ /dev/null
@@ -1,32 +0,0 @@
-COLM_BIN = ../../colm/colm
-COLM_WRAP = ../../colm/colm-wrap
-COLM_LA = ../../colm/libcolm.la
-COLM_LIBDEP = $(COLM_LA)
-COLM_BINDEP = $(COLM_BIN) $(COLM_WRAP)
-
-bin_PROGRAMS = ragel-d
-
-ragel_d_CPPFLAGS = -I$(top_srcdir)/aapl -I$(top_srcdir)/ragel -I$(top_srcdir)/colm/include
-
-dist_ragel_d_SOURCES = main.cc rlhc.c
-
-nodist_ragel_d_SOURCES = \
- rlparse.c rlreduce.cc
-
-ragel_d_LDADD = ../libragel.la ../libfsm.la $(COLM_LA)
-
-BUILT_SOURCES = rlparse.c rlreduce.cc rlhc.c
-
-EXTRA_DIST = rlparse.lm rlhc.lm
-
-rlparse.pack: rlparse.lm $(COLM_BINDEP)
- $(COLM_WRAP) -c -I .. -b rlparseD -o $@ -p rlparse.c -m rlreduce.cc $<
-
-rlparse.c: rlparse.pack
- $(COLM_WRAP) -o $@ $<
-
-rlreduce.cc: rlparse.pack
- $(COLM_WRAP) -o $@ $<
-
-rlhc.c: rlhc.lm ../ril.lm $(COLM_BINDEP)
- $(COLM_BIN) -c -I .. -b rlhcD -o $@ $<
diff --git a/ragel/host-d/main.cc b/ragel/host-d/main.cc
deleted file mode 100644
index f6eb7cbe..00000000
--- a/ragel/host-d/main.cc
+++ /dev/null
@@ -1,72 +0,0 @@
-/*
- * Copyright 2001-2018 Adrian Thurston <thurston@colm.net>
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to
- * deal in the Software without restriction, including without limitation the
- * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
- * sell copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in all
- * copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-
-#include "inputdata.h"
-
-extern struct colm_sections rlparseD;
-extern struct colm_sections rlhcD;
-
-/*
- * D
- */
-
-const char *defaultOutFnD( const char *inputFileName )
-{
- const char *ext = findFileExtension( inputFileName );
- if ( ext != 0 && strcmp( ext, ".rh" ) == 0 )
- return fileNameFromStem( inputFileName, ".h" );
- else
- return fileNameFromStem( inputFileName, ".d" );
-}
-
-HostType hostTypesD[] =
-{
- { "byte", 0, "byte", true, true, false, CHAR_MIN, CHAR_MAX, 0, 0, 1 },
- { "ubyte", 0, "ubyte", false, true, false, 0, 0, 0, UCHAR_MAX, 1 },
- { "char", 0, "char", false, true, false, 0, 0, 0, UCHAR_MAX, 1 },
- { "short", 0, "short", true, true, false, SHRT_MIN, SHRT_MAX, 0, 0, 2 },
- { "ushort", 0, "ushort", false, true, false, 0, 0, 0, USHRT_MAX, 2 },
- { "wchar", 0, "wchar", false, true, false, 0, 0, 0, USHRT_MAX, 2 },
- { "int", 0, "int", true, true, false, INT_MIN, INT_MAX, 0, 0, 4 },
- { "uint", 0, "uint", false, true, false, 0, 0, 0, UINT_MAX, 4 },
- { "dchar", 0, "dchar", false, true, false, 0, 0, 0, UINT_MAX, 4 },
-};
-
-const HostLang hostLangD =
-{
- hostTypesD,
- 9,
- 2,
- true,
- false, /* loopLabels */
- Translated,
- GotoFeature,
- &makeCodeGen,
- &defaultOutFnD,
- &genLineDirectiveTrans
-};
-
-int main( int argc, const char **argv )
-{
- InputData id( &hostLangD, &rlparseD, &rlhcD );
- return id.rlhcMain( argc, argv );
-}
diff --git a/ragel/host-d/rlhc.lm b/ragel/host-d/rlhc.lm
deleted file mode 100644
index 2a047e68..00000000
--- a/ragel/host-d/rlhc.lm
+++ /dev/null
@@ -1,511 +0,0 @@
-include 'ril.lm'
-
-namespace d_out
- token _IN_ /''/
- token _EX_ /''/
-
- lex
- token comment /
- '//' any* :> '\n' |
- '/*' any* :>> '*/'
- /
-
- token id
- /[a-zA-Z_][a-zA-Z_0-9]*/
-
- token number /
- [0-9]+
- /
-
- token symbol /
- '!' | '#' | '$' | '%' | '&' | '(' | ')' | '*' |
- '+' | ',' | '-' | '.' | '/' | ':' | ';' | '<' |
- '=' | '>' | '?' | '@' | '[' | ']' | '^' | '|' |
- '~' /
-
- literal `{ `}
-
- token string /
- '"' ( [^"\\] | '\\' any ) * '"' |
- "'" ( [^'\\] | '\\' any ) * "'"
- /
-
- ignore
- /[ \t\v\r\n]+/
- end
-
- def item
- [comment]
- | [id]
- | [number]
- | [symbol]
- | [string]
- | [`{ _IN_ item* _EX_ `} ]
-
- def d_out
- [_IN_ _EX_ item*]
-end
-
-namespace d_gen
-
- global Parser: parser<d_out::d_out>
-
- global HasDefault: list<int> = new list<int>()
-
- void pushHasDef( H: int )
- {
- HasDefault->push( H )
- }
-
- int popHasDef()
- {
- return HasDefault->pop()
- }
-
- void tok_list( TL: host::tok* )
- {
- for Tok: host::tok in repeat(TL) {
- switch Tok
- case [host::`${ StmtList: stmt* host::`}$]
- send Parser "{[stmt_list( StmtList )]}"
- case [host::`={ Expr: expr host::`}=]
- send Parser "([expr( Expr )])"
- case [E: escape] {
- Str: str = $E
- send Parser
- "[Str.suffix( 1 )]"
- }
- default {
- send Parser [Tok]
- }
- }
- }
-
- void embedded_host( EmbeddedHost: embedded_host )
- {
- switch EmbeddedHost
- case [`host `( string `, uint `) `={ TL: host::tok* host::`}=]
- {
- send Parser
- "([tok_list( TL )])"
- }
- case [`host `( string `, uint `) `${ TL: host::tok* host::`}$]
- {
- send Parser
- "{[tok_list( TL )]}
- }
- case [`host `( string `, uint `) `@{ TL: host::tok* host::`}@]
- {
- send Parser
- [tok_list( TL )]
- }
- }
-
- void expr_factor( ExprFactor: expr_factor )
- {
- switch ExprFactor
- case [EH: embedded_host]
- {
- send Parser
- [embedded_host(EH)]
- }
- case
- [O:`( TL: expr C: `)]
- {
- send Parser
- [O expr( TL ) C]
- }
- case
- [ident O: `[ TL: expr C: `]]
- {
- send Parser
- [ExprFactor.ident O expr(TL) C]
- }
- case
- [`offset `( ident `, expr `)]
- {
- send Parser
- "& [ExprFactor.ident] \[ [expr(ExprFactor.expr)] \]
- }
- case
- [`deref `( ident `, expr `)]
- {
- send Parser
- "(*( [expr(ExprFactor.expr)] ))
- }
- case
- [T: `TRUE]
- {
- T.data = '1'
- send Parser [T]
- }
- case
- [F: `FALSE]
- {
- F.data = '0'
- send Parser [F]
- }
- case
- [N: `nil]
- {
- N.data = 'null'
- send Parser [N]
- }
- case
- [Number: number]
- {
- number( Number )
- }
- case [E1: embedded_host `-> E2: expr_factor]
- {
- embedded_host( E1 )
- expr_factor( E2 )
- }
- case [`cast Open: `( Type: type Close: `) expr_factor]
- {
- send Parser ['cast' Open]
- type( Type )
- send Parser [Close]
- expr_factor( ExprFactor._expr_factor )
- }
- default {
- # Catches cases not specified
- send Parser [ExprFactor]
- }
- }
-
- void lvalue( ExprFactor: lvalue )
- {
- switch ExprFactor
- case [EH: embedded_host]
- {
- send Parser
- [embedded_host(EH)]
- }
- case
- [ident O: `[ TL: expr C: `]]
- {
- send Parser
- [ExprFactor.ident O expr(TL) C]
- }
- case [E1: embedded_host `-> E2: lvalue]
- {
- embedded_host( E1 )
- lvalue( E2 )
- }
- default {
- # Catches cases not specified
- send Parser [ExprFactor]
- }
- }
-
- void expr_factor_op( ExprFactorOp: expr_factor_op )
- {
- switch ExprFactorOp
- case [B: `! expr_factor_op]
- {
- send Parser [B]
- expr_factor_op( ExprFactorOp._expr_factor_op )
- }
- case [T: `~ expr_factor_op]
- {
- send Parser [T]
- expr_factor_op( ExprFactorOp._expr_factor_op )
- }
- case [expr_factor]
- {
- expr_factor( ExprFactorOp.expr_factor )
- }
- }
-
- void expr_bitwise( ExprBitwise: expr_bitwise )
- {
- switch ExprBitwise
- case [expr_bitwise A: `& expr_factor_op]
- {
- expr_bitwise( ExprBitwise._expr_bitwise )
- send Parser [A]
- expr_factor_op( ExprBitwise.expr_factor_op )
- }
- case [expr_factor_op]
- {
- expr_factor_op( ExprBitwise.expr_factor_op )
- }
- }
-
- void expr_mult( ExprMult: expr_mult )
- {
- switch ExprMult
- case [expr_mult T: `* expr_bitwise]
- {
- expr_mult( ExprMult._expr_mult )
- send Parser [T]
- expr_bitwise( ExprMult.expr_bitwise )
- }
- case [expr_bitwise]
- {
- expr_bitwise( ExprMult.expr_bitwise )
- }
- }
-
- void expr_add( ExprAdd: expr_add )
- {
- switch ExprAdd
- case [expr_add Op: add_op expr_mult]
- {
- expr_add( ExprAdd._expr_add )
- send Parser [Op]
- expr_mult( ExprAdd.expr_mult )
- }
- case [expr_mult]
- {
- expr_mult( ExprAdd.expr_mult )
- }
- }
-
- void expr_shift( ExprShift: expr_shift )
- {
- switch ExprShift
- case [expr_shift Op: shift_op expr_add]
- {
- expr_shift( ExprShift._expr_shift )
- send Parser [Op]
- expr_add( ExprShift.expr_add )
- }
- case [expr_add]
- {
- expr_add( ExprShift.expr_add )
- }
- }
-
- void expr_test( ExprTest: expr_test )
- {
- switch ExprTest
- case [expr_test Op: test_op expr_shift]
- {
- expr_test( ExprTest._expr_test )
- send Parser [Op]
- expr_shift( ExprTest.expr_shift )
- }
- case [expr_shift]
- {
- expr_shift( ExprTest.expr_shift )
- }
- }
-
- void expr( Expr: expr )
- {
- expr_test( Expr.expr_test )
- }
-
- void type( Type: type )
- {
- switch Type
- case "s8"
- send Parser ['byte ']
- case "s16"
- send Parser ['short ']
- case "s32"
- send Parser ['int ']
- case "s64"
- send Parser ['long ']
- case "s128"
- send Parser ['long long ']
- default
- send Parser [Type]
- }
-
- void number( Number: number )
- {
- switch Number
- case [`u `( uint `) ]
- send Parser "[Number.uint]u"
- default
- send Parser [Number]
- }
-
- void num_list( NumList: num_list )
- {
- for Number: number in NumList
- send Parser "[number( Number )], "
- }
-
- void stmt( Stmt: stmt )
- {
- switch Stmt
- case [EH: embedded_host]
- {
- send Parser
- [embedded_host(EH)]
- }
- case [A: static_array] {
- send Parser
- "static const [type(A.type)]\[\] "
- "[A.ident] = \[ [num_list( A.num_list )] \];
- }
- case [V: static_value] {
- send Parser
- "static const [V.type] [V.ident] = [V.number];
- }
- case [
- `if `( IfExpr: expr `) IfStmt: stmt
- ElseIfClauseList: else_if_clause* ElseClauseOpt: else_clause?
- ] {
- send Parser
- "if ( [expr(IfExpr)] )
- " [stmt(IfStmt)]
-
- for ElseIfClause: else_if_clause in repeat( ElseIfClauseList ) {
- match ElseIfClause
- [`else `if `( ElseIfExpr: expr `) ElseIfStmt: stmt]
-
- send Parser
- "else if ( [expr(ElseIfExpr)] )
- " [stmt(ElseIfStmt)]
- }
-
- if ( match ElseClauseOpt ['else' ElseStmt: stmt] ) {
- send Parser
- "else
- " [stmt(ElseStmt)]
- }
- }
- case [`while `( WhileExpr: expr `) WhileStmt: stmt] {
- send Parser
- "while ( [expr(WhileExpr)] )
- " [stmt(WhileStmt)]
- }
- case [`switch `( SwitchExpr: expr `) `{ StmtList: stmt* `}] {
- pushHasDef( 0 )
-
- send Parser
- "switch ( [expr(SwitchExpr)] ) {
- " [stmt_list(StmtList)]
-
- if ( popHasDef() == 0 ) {
- send Parser
- " default: break;
- }
-
- send Parser
- "}
- }
- case [ExprExpr: expr Semi: `;] {
- send Parser
- [expr( ExprExpr ) Semi]
- }
- case [L: `{ TL: stmt* R: `}] {
- send Parser
- [L stmt_list( TL ) R]
- }
- case [
- OptConst: opt_const Type: type
- Ident: ident OptInit: opt_init Semi: `;
- ]
- {
- if match OptConst ['const'] {
- send Parser
- "const( [type( Type )] )
- }
- else {
- type( Type )
- }
-
- send Parser [Ident]
-
- if match OptInit [E: `= expr] {
- send Parser
- [E expr(OptInit.expr)]
- }
-
- send Parser [Semi]
- }
- case [case_block]
- {
- send Parser
- "case [expr( Stmt.case_block.expr )]:
- "[stmt_list( Stmt.case_block._repeat_stmt )]
- "break;
- }
- case [default_block]
- {
- send Parser
- "default:
- "[stmt_list( Stmt.default_block._repeat_stmt )]
- "break;
-
- popHasDef()
- pushHasDef( 1 )
- }
- case [case_label]
- {
- send Parser
- "case [expr( Stmt.case_label.expr )]:
- }
- case [export_stmt]
- {
- send Parser
- "static const [type(Stmt.export_stmt.type)] "
- "[Stmt.export_stmt.ident] = [number(Stmt.export_stmt.number)];
- }
- case ['fallthrough' ';']
- {
- send Parser "goto case;"
- }
- case [Index: index_stmt]
- {
- send Parser
- "const([type(Index.type)]) *[Index.ident]"
-
- if match Index.opt_init [E: `= expr] {
- send Parser
- [E expr(Index.opt_init.expr)]
- }
-
- send Parser ";
- }
- case [AS: assign_stmt]
- {
- send Parser
- "[lvalue(AS.LValue) AS.assign_op expr(AS.expr)];
- }
- default {
- # catches unspecified cases
- send Parser [Stmt]
- }
- }
-
- void stmt_list( StmtList: stmt* )
- {
- for Stmt: stmt in repeat( StmtList )
- stmt( Stmt )
- }
-
- void trans( Output: stream, Start: start )
- {
- Parser = new parser<d_out::d_out>()
-
- if ( Start.opt_bom.bom )
- send Output [Start.opt_bom.bom]
-
- stmt_list( Start._repeat_stmt )
-
- DO: d_out::d_out = Parser->finish()
-
- if DO {
- send Output
- [DO]
- }
- else {
- send stderr
- "failed to parse output: [Parser->error]
- }
- }
-end
-
-void trans( Output: stream, Start: start )
-{
- d_gen::trans( Output, Start )
-}
-
-include 'rlhc-main.lm'
diff --git a/ragel/host-d/rlparse.lm b/ragel/host-d/rlparse.lm
deleted file mode 100644
index 05b21ea2..00000000
--- a/ragel/host-d/rlparse.lm
+++ /dev/null
@@ -1,211 +0,0 @@
-include 'ragel.lm'
-include 'rlreduce.lm'
-
-namespace inline
- lex
- literal `fpc `fc `fcurs `ftargs
- `fentry `fhold `fexec `fgoto `fnext
- `fcall `fret `fbreak `fncall `fnret `fnbreak
-
- token ident /ident/
- token number /digit+/
- token hex_number /'0x' [0-9a-fA-F]+/
- token dec_number /'0x' [0-9a-fA-F]+/
-
- token comment
- / c_comment | cpp_comment /
-
- token string
- / s_literal | d_literal /
-
- token whitespace
- / ( [ \t] | NL )+ /
-
- literal
- `{ `} `:: `* `, `( `) `;
-
- token var_ref
- / "$" [a-zA-Z_][a-zA-Z_0-9]* /
- {
- if GblActionParams
- {
- input->push( make_token(
- typeid<var_ref>, input->pull( match_length ) ) )
- }
- else
- {
- # Just pull one char. Don't consume the word because it may
- # be a keyword.
- input->push( make_token(
- typeid<c_any>, input->pull( 1 ) ) )
- }
- }
-
- token c_any
- / any /
- end
-
-end
-
-namespace host
- lex
- literal `%%{
-
- token close_inc /'}--%%'/
- {
- input->push( make_token( typeid<close_inc>, input->pull( match_length ) ) )
- restoreGlobals()
- }
-
- token close_imp /'}++%%'/
- {
- input->push( make_token( typeid<close_imp>, input->pull( match_length ) ) )
- restoreGlobals()
- }
-
- token slr / '%%' [^{] [^\n]* '\n' /
- {
- # Translates single line to multi-line
- input->pull( 2 )
- R: str = input->pull( match_length - 3 )
- input->push( "}%%" )
- input->push( R )
- input->push( "%%{" )
- }
-
- rl NL / '\n' /
-
- rl s_literal
- / "'" ([^'\\\n] | '\\' (any | NL))* "'" /
-
- rl d_literal
- / '"' ([^"\\] | NL | '\\' (any | NL))* '"' /
-
- literal `define `=
-
- token ident /ident "'"?/
- token number /digit+/
- token hex_number /'0x' [0-9a-fA-F]+/
-
- token comment
- / c_comment | cpp_comment /
-
- token string
- / s_literal | d_literal /
-
- token whitespace
- / ( [ \t] | NL )+ /
-
- token c_any / any /
- end
-
- def tok
- [`define whitespace ident whitespace? number] :ImportDefNum
- | [`define whitespace ident whitespace? string] :ImportDefStr
- | [ident whitespace? `= whitespace? number] :ImportAssignNum
- | [ident whitespace? `= whitespace? string] :ImportAssignStr
- | [`define] :Def
- | [`=] :Eq
- | [ident] :Ident
- | [number] :Number
- | [hex_number] :HexNumber
- | [comment] :Comment
- | [string] :String
- | [whitespace] :Whitespace
- | [c_any] :Any
-end
-
-reduction TopLevel
-
- # Pass Through.
- # def tok
- # [`define ident number] :Def1
- # | [`define ident string] :Def2
- # | [ident `= number] :Ass1
- # | [ident `= string] :Ass2
- # [`define whitespace ident whitespace? number] :ImportDefNum
- # | [`define whitespace ident whitespace? string] :ImportDefStr
- # | [ident whitespace? `= whitespace? number] :ImportAssignNum
- # | [ident whitespace? `= whitespace? string] :ImportAssignStr
- # | [`define] :Def
- # | [`=] :Eq
- # | [ident] :Ident
- # | [number] :Number
- # | [hex_number] :HexNumber
- # | [comment] :Comment
- # | [string] :String
- # | [whitespace] :Whitespace
- # | [c_any] :Any
-
- host::tok :ImportDefNum
- {
- if ( isImport )
- {
- Literal *lit = new Literal( @number,
- false /* $number->neg */, $number->data,
- $number->length, Literal::Number );
-
- string name( $ident->data, $ident->length );
- import( @ident, name, lit );
- }
- else
- {
- if ( includeDepth == 0 ) {
- id->curItem->data.write( "define ", 7 );
- id->curItem->data.write( $ident->data, $ident->length );
- id->curItem->data.write( " ", 1 );
- id->curItem->data.write( $number->data, $number->length );
- }
- }
- }
- host::tok :ImportDefStr
- {
- if ( isImport )
- {
- Literal *lit = new Literal( @string, false,
- $string->data, $string->length, Literal::LitString );
- string name( $ident->data, $ident->length );
- import( @ident, name, lit );
- }
- }
- host::tok :ImportAssignNum
- {
- if ( isImport )
- {
- Literal *lit = new Literal( @number,
- false /*$number->neg */, $number->data,
- $number->length, Literal::Number );
- string name( $ident->data, $ident->length );
- import( @ident, name, lit );
- }
- }
- host::tok :ImportAssignStr
- {
- if ( isImport )
- {
- Literal *lit = new Literal( @string, false,
- $string->data, $string->length, Literal::LitString );
-
- string name( $ident->data, $ident->length );
- import( @ident, name, lit );
- }
- }
-
-end
-
-export RagelError: str
-
-# File name. The open is expected to succeed. It is tested before the colm
-# program is called.
-A: list_el<str> = argv->pop_head_el()
-GblFileName = A->value
-
-# Remaining items are include paths.
-while ( argv->length > 0 ) {
- A = argv->pop_head_el()
- GblIncludePaths->push_tail_el( A )
-}
-
-Stream: stream = open( GblFileName, "r" )
-reduce TopLevel start[ Stream ]
-RagelError = error