"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "src/reducer.lm" between
ragel-7.0.0.9.tar.gz and ragel-7.0.0.10.tar.gz

About:

reducer.lm  (ragel-7.0.0.9):reducer.lm  (ragel-7.0.0.10)
reduction TopLevel reduction TopLevel
# def machine_name # def machine_name
# [`machine word `;] :MachineName # [`machine word `;] :MachineName
ragel::machine_name :MachineName ragel::machine_name :MachineName
{ {
InputLoc sectionLoc; string machine( $mn_word->data, $mn_word->length );
string machine( $word->data, $word->length );
if ( includeDepth == 0 ) {
/* Maintain section dict, section list and the cur sectio
n pointer
* if we are in the top level. */
SectionDictEl *sdEl = id->sectionDict.find( machine );
if ( sdEl == 0 ) {
sdEl = new SectionDictEl( machine );
sdEl->value = new Section( machine );
id->sectionDict.insert( sdEl );
id->sectionList.append( sdEl->value );
}
section = sdEl->value;
}
if ( includeDepth > 0 ) { if ( includeDepth > 0 ) {
/* Check if the the machine is the one we are searching f /* If including, check if the the machine is the one we a
or. If re
* not, reset pd. Otherwise, rename it to target machine * searching for. If not, reset pd. Otherwise, rename it
because we to target
* are drawing the statements into target. */ * machine because we are drawing the statements into tar
get. */
if ( machine == searchMachine ) if ( machine == searchMachine )
machine = targetMachine; machine = targetMachine;
} }
SectionDictEl *sdEl = id->sectionDict.find( machine.c_str() );
assert( sdEl != 0 );
ParseDataDictEl *pdEl = id->parseDataDict.find( machine ); ParseDataDictEl *pdEl = id->parseDataDict.find( machine );
if ( pdEl == 0 ) { if ( pdEl == 0 ) {
InputLoc sectionLoc = @1;
pdEl = new ParseDataDictEl( machine ); pdEl = new ParseDataDictEl( machine );
pdEl->value = new ParseData( id, machine, pdEl->value = new ParseData( id, machine,
id->nextMachineId++, sectionLoc, hostLang , id->nextMachineId++, sectionLoc, hostLang ,
minimizeLevel, minimizeOpt ); minimizeLevel, minimizeOpt );
id->parseDataDict.insert( pdEl ); id->parseDataDict.insert( pdEl );
id->parseDataList.append( pdEl->value ); id->parseDataList.append( pdEl->value );
} }
pd = pdEl->value; pd = pdEl->value;
} }
skipping to change at line 265 skipping to change at line 276
ragel::statement :Access ragel::statement :Access
{ {
pd->fsmCtx->accessExpr = $inline_expr_reparse->inlineList; pd->fsmCtx->accessExpr = $inline_expr_reparse->inlineList;
} }
# def statement # def statement
# | [`write Cmd: word ArgList: write_arg* `;] :Write commit # | [`write Cmd: word ArgList: write_arg* `;] :Write commit
ragel::statement :Write ragel::statement :Write
{ {
if ( includeDepth == 0 ) { if ( !isImport && includeDepth == 0 ) {
{
InputItem *inputItem = new InputItem;
inputItem->type = InputItem::Write;
inputItem->loc = @Cmd;
inputItem->name = section->sectionName;
inputItem->section = section;
id->inputItems.append( inputItem );
}
id->curItem = id->curItem->next; id->curItem = id->curItem->next;
InputItem *inputItem = id->curItem; InputItem *inputItem = id->curItem;
string cmd( $Cmd->data, $Cmd->length ); string cmd( $Cmd->data, $Cmd->length );
inputItem->writeArgs.push_back( cmd ); inputItem->writeArgs.push_back( cmd );
inputItem->writeArgs.insert( inputItem->writeArgs.end(), writeArgs.begin(), writeArgs.end() ); inputItem->writeArgs.insert( inputItem->writeArgs.end(), writeArgs.begin(), writeArgs.end() );
inputItem->pd = pd; inputItem->pd = pd;
} }
skipping to change at line 323 skipping to change at line 343
{ {
InputLoc loc = @string; InputLoc loc = @string;
std::string fileName( $string->data, $string->length ); std::string fileName( $string->data, $string->length );
long length; long length;
bool caseInsensitive; bool caseInsensitive;
char *unescaped = prepareLitString( pd->id, loc, char *unescaped = prepareLitString( pd->id, loc,
fileName.c_str(), fileName.size(), fileName.c_str(), fileName.size(),
length, caseInsensitive ); length, caseInsensitive );
loadImport( unescaped ); importFile( unescaped );
} }
# def statement # def statement
# [`include include_spec `;] :Include commit # [`include include_spec `;] :Include commit
ragel::statement :Include ragel::statement :Include
{ {
string fileName = id->inputFileName; string fileName = id->inputFileName;
string machine = pd->sectionName; string machine = pd->sectionName;
bool fileSpecified = false; bool fileSpecified = false;
skipping to change at line 862 skipping to change at line 882
$$->paramList->append( $action_param->param ); $$->paramList->append( $action_param->param );
} }
ragel::action_param_list :Base ragel::action_param_list :Base
{ {
$$->paramList = new ActionParamList; $$->paramList = new ActionParamList;
$$->paramList->append( $action_param->param ); $$->paramList->append( $action_param->param );
} }
# def action_block # def action_block
# [`{ c_select CInlineBlock: c_inline::inline_block `}] :C # [`{ c_select CInlineBlock: inline::inline_block `}] :C
# | [`{ ruby_select RubyInlineBlock: ruby_inline::inline_block ruby_ inline::`}] # | [`{ ruby_select RubyInlineBlock: ruby_inline::inline_block ruby_ inline::`}]
# | [`{ ocaml_select OCamlInlineBlock: ocaml_inline::inline_block oca ml_inline::`}] # | [`{ ocaml_select OCamlInlineBlock: ocaml_inline::inline_block oca ml_inline::`}]
# | [`{ crack_select OCamlInlineBlock: crack_inline::inline_block cra ck_inline::`}] # | [`{ crack_select OCamlInlineBlock: crack_inline::inline_block cra ck_inline::`}]
ragel::action_block ragel::action_block
{ {
colm_location loc; colm_location loc;
InlineList *inlineList; InlineList *inlineList;
} }
ragel::action_block :C ragel::action_block :ActionBlock
{ {
$$->loc = *@1; $$->loc = *@1;
$$->inlineList = $CInlineBlock->inlineList; $$->inlineList = $CInlineBlock->inlineList;
} }
# def inline_expr_reparse # def inline_expr_reparse
# [_inline_expr_reparse] :Reparse # [_inline_expr_reparse] :Reparse
# | [action_expr] :ActionExpr # | [action_expr] :ActionExpr
ragel::inline_expr_reparse ragel::inline_expr_reparse
{ {
InlineList *inlineList; InlineList *inlineList;
} }
ragel::inline_expr_reparse :ActionExpr ragel::inline_expr_reparse :ActionExpr
{ {
$$->inlineList = $action_expr->inlineList; $$->inlineList = $action_expr->inlineList;
} }
# def action_expr # def action_expr
# [`{ c_select CInlineExpr: c_inline::inline_expr `}] :C # [`{ c_select CInlineExpr: inline::inline_expr `}] :C
# | [`{ ruby_select RubyInlineExpr: ruby_inline::inline_expr ruby_in line::`}] # | [`{ ruby_select RubyInlineExpr: ruby_inline::inline_expr ruby_in line::`}]
# | [`{ ocaml_select OCamlInlineExpr: ocaml_inline::inline_expr ocaml _inline::`}] # | [`{ ocaml_select OCamlInlineExpr: ocaml_inline::inline_expr ocaml _inline::`}]
# | [`{ crack_select CrackInlineExpr: crack_inline::inline_expr crack _inline::`}] # | [`{ crack_select CrackInlineExpr: crack_inline::inline_expr crack _inline::`}]
ragel::action_expr ragel::action_expr
{ {
colm_location loc; colm_location loc;
InlineList *inlineList; InlineList *inlineList;
} }
ragel::action_expr :C ragel::action_expr :ActionExpr
{ {
$$->loc = *@1; $$->loc = *@1;
$$->inlineList = $CInlineExpr->inlineList; $$->inlineList = $CInlineExpr->inlineList;
} }
# def inline_block # def inline_block
# [block_item_list] :List # [block_item_list] :List
c_inline::inline_block inline::inline_block
{ {
InlineList *inlineList; InlineList *inlineList;
} }
c_inline::inline_block :List inline::inline_block :List
{ {
$$->inlineList = $block_item_list->inlineList; $$->inlineList = $block_item_list->inlineList;
} }
# def block_item_list # def block_item_list
# [block_item block_item_list] :Rec # [block_item block_item_list] :Rec
# | [] :Base # | [] :Base
c_inline::block_item_list inline::block_item_list
{ {
InlineList *inlineList; InlineList *inlineList;
} }
c_inline::block_item_list :Rec inline::block_item_list :Rec
{ {
$$->inlineList = $_block_item_list->inlineList; $$->inlineList = $_block_item_list->inlineList;
if ( $block_item->inlineItem != 0 ) if ( $block_item->inlineItem != 0 )
$$->inlineList->prepend( $block_item->inlineItem ); $$->inlineList->prepend( $block_item->inlineItem );
else if ( $block_item->inlineList != 0 ) { else if ( $block_item->inlineList != 0 ) {
$$->inlineList->prepend( *$block_item->inlineList ); $$->inlineList->prepend( *$block_item->inlineList );
delete $block_item->inlineList; delete $block_item->inlineList;
} }
} }
c_inline::block_item_list :Base inline::block_item_list :Base
{ {
$$->inlineList = new InlineList; $$->inlineList = new InlineList;
} }
# def block_item # def block_item
# [expr_any] :ExprAny # [expr_any] :ExprAny
# | [block_symbol] :BlockSymbol # | [block_symbol] :BlockSymbol
# | [block_interpret] :BlockInterpret # | [block_interpret] :BlockInterpret
# | [`{ inline_block `}] :RecBlock # | [`{ inline_block `}] :RecBlock
c_inline::block_item inline::block_item
{ {
InlineItem *inlineItem; InlineItem *inlineItem;
InlineList *inlineList; InlineList *inlineList;
} }
c_inline::block_item :ExprAny inline::block_item :ExprAny
{ {
$$->inlineItem = $expr_any->inlineItem; $$->inlineItem = $expr_any->inlineItem;
} }
c_inline::block_item :BlockSymbol inline::block_item :BlockSymbol
{ {
$$->inlineItem = $block_symbol->inlineItem; $$->inlineItem = $block_symbol->inlineItem;
} }
c_inline::block_item :BlockInterpret inline::block_item :BlockInterpret
{ {
$$->inlineItem = $block_interpret->inlineItem; $$->inlineItem = $block_interpret->inlineItem;
} }
c_inline::block_item :RecBlock inline::block_item :RecBlock
{ {
$$->inlineList = $inline_block->inlineList; $$->inlineList = $inline_block->inlineList;
$$->inlineList->prepend( new InlineItem( @1, "{", InlineItem::Tex t ) ); $$->inlineList->prepend( new InlineItem( @1, "{", InlineItem::Tex t ) );
$$->inlineList->append( new InlineItem( @1, "}", InlineItem::Text ) ); $$->inlineList->append( new InlineItem( @1, "}", InlineItem::Text ) );
$$->inlineItem = 0; $$->inlineItem = 0;
} }
# def expr_any # def expr_any
# [whitespace] :WS # [whitespace] :WS
#| [comment] :Comment #| [comment] :Comment
#| [string] :String #| [string] :String
#| [number] :Number #| [number] :Number
#| [hex_number] :Hex #| [hex_number] :Hex
#| [ident] :Ident #| [ident] :Ident
#| [c_any] :Any #| [c_any] :Any
c_inline::expr_any inline::expr_any
{ {
InlineItem *inlineItem; InlineItem *inlineItem;
} }
c_inline::expr_any :WS inline::expr_any :WS
{ {
string data( $whitespace->data, $whitespace->length ); string data( $whitespace->data, $whitespace->length );
$$->inlineItem = new InlineItem( @whitespace, data, InlineItem::T ext ); $$->inlineItem = new InlineItem( @whitespace, data, InlineItem::T ext );
} }
c_inline::expr_any :Comment inline::expr_any :Comment
{ {
string data( $comment->data, $comment->length ); string data( $comment->data, $comment->length );
$$->inlineItem = new InlineItem( @comment, data, InlineItem::Text ); $$->inlineItem = new InlineItem( @comment, data, InlineItem::Text );
} }
c_inline::expr_any :String inline::expr_any :String
{ {
string data( $string->data, $string->length ); string data( $string->data, $string->length );
$$->inlineItem = new InlineItem( @string, data, InlineItem::Text ); $$->inlineItem = new InlineItem( @string, data, InlineItem::Text );
} }
c_inline::expr_any :Number inline::expr_any :Number
{ {
string data( $number->data, $number->length ); string data( $number->data, $number->length );
$$->inlineItem = new InlineItem( @number, data, InlineItem::Text ); $$->inlineItem = new InlineItem( @number, data, InlineItem::Text );
} }
c_inline::expr_any :Hex inline::expr_any :Hex
{ {
string data( $hex_number->data, $hex_number->length ); string data( $hex_number->data, $hex_number->length );
$$->inlineItem = new InlineItem( @hex_number, data, InlineItem::T ext ); $$->inlineItem = new InlineItem( @hex_number, data, InlineItem::T ext );
} }
c_inline::expr_any :Ident inline::expr_any :Ident
{ {
string data( $ident->data, $ident->length ); string data( $ident->data, $ident->length );
$$->inlineItem = new InlineItem( @ident, data, InlineItem::Text ) ; $$->inlineItem = new InlineItem( @ident, data, InlineItem::Text ) ;
} }
c_inline::expr_any :Any inline::expr_any :Any
{ {
string data( $c_any->data, $c_any->length ); string data( $c_any->data, $c_any->length );
$$->inlineItem = new InlineItem( @c_any, data, InlineItem::Text ) ; $$->inlineItem = new InlineItem( @c_any, data, InlineItem::Text ) ;
} }
# def block_symbol # def block_symbol
# [`,] :B1 | [`;] :B2 | [`(] :B3 | [`)] :B4 | [`*] :B5 | [`::] :B6 # [`,] :B1 | [`;] :B2 | [`(] :B3 | [`)] :B4 | [`*] :B5 | [`::] :B6
c_inline::block_symbol inline::block_symbol
{ {
InlineItem *inlineItem; InlineItem *inlineItem;
} }
c_inline::block_symbol :B1 inline::block_symbol :B1
{ {
string data( $1->data, $1->length ); string data( $1->data, $1->length );
$$->inlineItem = new InlineItem( @1, data, InlineItem::Text ); $$->inlineItem = new InlineItem( @1, data, InlineItem::Text );
} }
c_inline::block_symbol :B2 inline::block_symbol :B2
{ {
string data( $1->data, $1->length ); string data( $1->data, $1->length );
$$->inlineItem = new InlineItem( @1, data, InlineItem::Text ); $$->inlineItem = new InlineItem( @1, data, InlineItem::Text );
} }
c_inline::block_symbol :B3 inline::block_symbol :B3
{ {
string data( $1->data, $1->length ); string data( $1->data, $1->length );
$$->inlineItem = new InlineItem( @1, data, InlineItem::Text ); $$->inlineItem = new InlineItem( @1, data, InlineItem::Text );
} }
c_inline::block_symbol :B4 inline::block_symbol :B4
{ {
string data( $1->data, $1->length ); string data( $1->data, $1->length );
$$->inlineItem = new InlineItem( @1, data, InlineItem::Text ); $$->inlineItem = new InlineItem( @1, data, InlineItem::Text );
} }
c_inline::block_symbol :B5 inline::block_symbol :B5
{ {
string data( $1->data, $1->length ); string data( $1->data, $1->length );
$$->inlineItem = new InlineItem( @1, data, InlineItem::Text ); $$->inlineItem = new InlineItem( @1, data, InlineItem::Text );
} }
c_inline::block_symbol :B6 inline::block_symbol :B6
{ {
string data( $1->data, $1->length ); string data( $1->data, $1->length );
$$->inlineItem = new InlineItem( @1, data, InlineItem::Text ); $$->inlineItem = new InlineItem( @1, data, InlineItem::Text );
} }
# def state_ref # def state_ref
# [opt_name_sep state_ref_names] :Ref # [opt_name_sep state_ref_names] :Ref
c_inline::state_ref state_ref::state_ref
{ {
NameRef *nameRef; NameRef *nameRef;
} }
c_inline::state_ref :Ref state_ref::state_ref :Ref
{ {
$$->nameRef = $state_ref_names->nameRef; $$->nameRef = $state_ref_names->nameRef;
if ( $opt_name_sep->nameSep ) if ( $opt_name_sep->nameSep )
$$->nameRef->prepend( "" ); $$->nameRef->prepend( "" );
} }
# def opt_name_sep # def opt_name_sep
# [srlex::`::] :ColonColon # [srlex::`::] :ColonColon
# | [] :Empty # | [] :Empty
c_inline::opt_name_sep state_ref::opt_name_sep
{ {
bool nameSep; bool nameSep;
} }
c_inline::opt_name_sep :ColonColon state_ref::opt_name_sep :ColonColon
{ {
$$->nameSep = true; $$->nameSep = true;
} }
c_inline::opt_name_sep :Empty state_ref::opt_name_sep :Empty
{ {
$$->nameSep = false; $$->nameSep = false;
} }
# def state_ref_names # def state_ref_names
# [state_ref_names srlex::`:: srlex::word] :Rec # [state_ref_names srlex::`:: srlex::word] :Rec
# | [srlex::word] :Base # | [srlex::word] :Base
c_inline::state_ref_names state_ref::state_ref_names
{ {
NameRef *nameRef; NameRef *nameRef;
} }
c_inline::state_ref_names :Rec state_ref::state_ref_names :Rec
{ {
$$->nameRef = $_state_ref_names->nameRef; $$->nameRef = $_state_ref_names->nameRef;
$$->nameRef->append( string( $word->data, $word->length ) ); $$->nameRef->append( string( $word->data, $word->length ) );
} }
c_inline::state_ref_names :Base state_ref::state_ref_names :Base
{ {
$$->nameRef = new NameRef; $$->nameRef = new NameRef;
$$->nameRef->append( string( $word->data, $word->length ) ); $$->nameRef->append( string( $word->data, $word->length ) );
} }
# def block_interpret # def block_interpret
# [expr_interpret] :ExprInterpret # [expr_interpret] :ExprInterpret
# | [`fhold whitespace? `;] :Fhold # | [`fhold whitespace? `;] :Fhold
# | [`fgoto whitespace? `* inline_expr `;] :FgotoExpr # | [`fgoto whitespace? `* inline_expr `;] :FgotoExpr
# | [`fnext whitespace? `* inline_expr `;] :FnextExpr # | [`fnext whitespace? `* inline_expr `;] :FnextExpr
skipping to change at line 1144 skipping to change at line 1164
# | [`fncall whitespace? `* inline_expr `;] :FncallExpr # | [`fncall whitespace? `* inline_expr `;] :FncallExpr
# | [`fexec inline_expr `;] :Fexec # | [`fexec inline_expr `;] :Fexec
# | [`fgoto state_ref srlex::`;] :FgotoSr # | [`fgoto state_ref srlex::`;] :FgotoSr
# | [`fnext state_ref srlex::`;] :FnextSr # | [`fnext state_ref srlex::`;] :FnextSr
# | [`fcall state_ref srlex::`;] :FcallSr # | [`fcall state_ref srlex::`;] :FcallSr
# | [`fncall state_ref srlex::`;] :FncallSr # | [`fncall state_ref srlex::`;] :FncallSr
# | [`fret `;] :Fret # | [`fret `;] :Fret
# | [`fnret `;] :Fnret # | [`fnret `;] :Fnret
# | [`fbreak `;] :Fbreak # | [`fbreak `;] :Fbreak
# | [`fnbreak `;] :Fnbreak # | [`fnbreak `;] :Fnbreak
c_inline::block_interpret inline::block_interpret
{ {
InlineItem *inlineItem; InlineItem *inlineItem;
} }
c_inline::block_interpret :Fhold inline::block_interpret :Fhold
{ {
$$->inlineItem = new InlineItem( @1, InlineItem::Hold ); $$->inlineItem = new InlineItem( @1, InlineItem::Hold );
} }
c_inline::block_interpret :FgotoExpr inline::block_interpret :FgotoExpr
{ {
$$->inlineItem = new InlineItem( @1, InlineItem::GotoExpr ); $$->inlineItem = new InlineItem( @1, InlineItem::GotoExpr );
$$->inlineItem->children = $inline_expr->inlineList; $$->inlineItem->children = $inline_expr->inlineList;
} }
c_inline::block_interpret :FnextExpr inline::block_interpret :FnextExpr
{ {
$$->inlineItem = new InlineItem( @1, InlineItem::NextExpr ); $$->inlineItem = new InlineItem( @1, InlineItem::NextExpr );
$$->inlineItem->children = $inline_expr->inlineList; $$->inlineItem->children = $inline_expr->inlineList;
} }
c_inline::block_interpret :FcallExpr inline::block_interpret :FcallExpr
{ {
$$->inlineItem = new InlineItem( @1, InlineItem::CallExpr ); $$->inlineItem = new InlineItem( @1, InlineItem::CallExpr );
$$->inlineItem->children = $inline_expr->inlineList; $$->inlineItem->children = $inline_expr->inlineList;
} }
c_inline::block_interpret :FncallExpr inline::block_interpret :FncallExpr
{ {
$$->inlineItem = new InlineItem( @1, InlineItem::NcallExpr ); $$->inlineItem = new InlineItem( @1, InlineItem::NcallExpr );
$$->inlineItem->children = $inline_expr->inlineList; $$->inlineItem->children = $inline_expr->inlineList;
} }
c_inline::block_interpret :Fexec inline::block_interpret :Fexec
{ {
$$->inlineItem = new InlineItem( @1, InlineItem::Exec ); $$->inlineItem = new InlineItem( @1, InlineItem::Exec );
$$->inlineItem->children = $inline_expr->inlineList; $$->inlineItem->children = $inline_expr->inlineList;
} }
c_inline::block_interpret :FgotoSr inline::block_interpret :FgotoSr
{ {
$$->inlineItem = new InlineItem( @1, $$->inlineItem = new InlineItem( @1,
$state_ref->nameRef, InlineItem::Goto ); $state_ref->nameRef, InlineItem::Goto );
} }
c_inline::block_interpret :FnextSr inline::block_interpret :FnextSr
{ {
$$->inlineItem = new InlineItem( @1, $$->inlineItem = new InlineItem( @1,
$state_ref->nameRef, InlineItem::Next ); $state_ref->nameRef, InlineItem::Next );
} }
c_inline::block_interpret :FcallSr inline::block_interpret :FcallSr
{ {
$$->inlineItem = new InlineItem( @1, $$->inlineItem = new InlineItem( @1,
$state_ref->nameRef, InlineItem::Call ); $state_ref->nameRef, InlineItem::Call );
} }
c_inline::block_interpret :FncallSr inline::block_interpret :FncallSr
{ {
$$->inlineItem = new InlineItem( @1, $$->inlineItem = new InlineItem( @1,
$state_ref->nameRef, InlineItem::Ncall ); $state_ref->nameRef, InlineItem::Ncall );
} }
c_inline::block_interpret :Fret inline::block_interpret :Fret
{ {
$$->inlineItem = new InlineItem( @1, InlineItem::Ret ); $$->inlineItem = new InlineItem( @1, InlineItem::Ret );
} }
c_inline::block_interpret :Fnret inline::block_interpret :Fnret
{ {
$$->inlineItem = new InlineItem( @1, InlineItem::Nret ); $$->inlineItem = new InlineItem( @1, InlineItem::Nret );
} }
c_inline::block_interpret :Fbreak inline::block_interpret :Fbreak
{ {
$$->inlineItem = new InlineItem( @1, InlineItem::Break ); $$->inlineItem = new InlineItem( @1, InlineItem::Break );
} }
c_inline::block_interpret :Fnbreak inline::block_interpret :Fnbreak
{ {
$$->inlineItem = new InlineItem( @1, InlineItem::Nbreak ); $$->inlineItem = new InlineItem( @1, InlineItem::Nbreak );
} }
c_inline::block_interpret :ExprInterpret inline::block_interpret :ExprInterpret
{ {
$$->inlineItem = $expr_interpret->inlineItem; $$->inlineItem = $expr_interpret->inlineItem;
} }
# def inline_expr # def inline_expr
# [expr_item_list] :List # [expr_item_list] :List
c_inline::inline_expr inline::inline_expr
{ {
InlineList *inlineList; InlineList *inlineList;
} }
c_inline::inline_expr :List inline::inline_expr :List
{ {
$$->inlineList = $expr_item_list->inlineList; $$->inlineList = $expr_item_list->inlineList;
} }
# def expr_item_list # def expr_item_list
# [expr_item_list expr_item] :Rec # [expr_item_list expr_item] :Rec
# | [] :Empty # | [] :Empty
c_inline::expr_item_list inline::expr_item_list
{ {
InlineList *inlineList; InlineList *inlineList;
} }
c_inline::expr_item_list :Rec inline::expr_item_list :Rec
{ {
$$->inlineList = $_expr_item_list->inlineList; $$->inlineList = $_expr_item_list->inlineList;
$$->inlineList->append( $expr_item->inlineItem ); $$->inlineList->append( $expr_item->inlineItem );
} }
c_inline::expr_item_list :Empty inline::expr_item_list :Empty
{ {
$$->inlineList = new InlineList; $$->inlineList = new InlineList;
} }
# def expr_item # def expr_item
# [expr_any] :ExprAny # [expr_any] :ExprAny
# | [expr_symbol] :ExprSymbol # | [expr_symbol] :ExprSymbol
# | [expr_interpret] :ExprInterpret # | [expr_interpret] :ExprInterpret
c_inline::expr_item inline::expr_item
{ {
InlineItem *inlineItem; InlineItem *inlineItem;
} }
c_inline::expr_item :ExprAny inline::expr_item :ExprAny
{ {
$$->inlineItem = $expr_any->inlineItem; $$->inlineItem = $expr_any->inlineItem;
} }
c_inline::expr_item :ExprSymbol inline::expr_item :ExprSymbol
{ {
string sym( $expr_symbol->sym ); string sym( $expr_symbol->sym );
$$->inlineItem = new InlineItem( &$expr_symbol->loc, sym, InlineI tem::Text ); $$->inlineItem = new InlineItem( &$expr_symbol->loc, sym, InlineI tem::Text );
} }
c_inline::expr_item :ExprInterpret inline::expr_item :ExprInterpret
{ {
$$->inlineItem = $expr_interpret->inlineItem; $$->inlineItem = $expr_interpret->inlineItem;
} }
# def expr_symbol # def expr_symbol
# [`,] | [`(] | [`)] | [`*] | [`::] # [`,] | [`(] | [`)] | [`*] | [`::]
c_inline::expr_symbol inline::expr_symbol
{ {
const char *sym; const char *sym;
colm_location loc; colm_location loc;
} }
c_inline::expr_symbol :Comma inline::expr_symbol :Comma
{ $$->loc = *@1; $$->sym = ","; } { $$->loc = *@1; $$->sym = ","; }
c_inline::expr_symbol :Open inline::expr_symbol :Open
{ $$->loc = *@1; $$->sym = "("; } { $$->loc = *@1; $$->sym = "("; }
c_inline::expr_symbol :Close inline::expr_symbol :Close
{ $$->loc = *@1; $$->sym = ")"; } { $$->loc = *@1; $$->sym = ")"; }
c_inline::expr_symbol :Star inline::expr_symbol :Star
{ $$->loc = *@1; $$->sym = "*"; } { $$->loc = *@1; $$->sym = "*"; }
c_inline::expr_symbol :DoubleColon inline::expr_symbol :DoubleColon
{ $$->loc = *@1; $$->sym = "::"; } { $$->loc = *@1; $$->sym = "::"; }
# def expr_interpret # def expr_interpret
# [`fpc] :Fpc # [`fpc] :Fpc
# | [`fc] :Fc # | [`fc] :Fc
# | [`fcurs] :Fcurs # | [`fcurs] :Fcurs
# | [`ftargs] :Ftargs # | [`ftargs] :Ftargs
# | [`fentry `( state_ref srlex::`)] :Fentry # | [`fentry `( state_ref srlex::`)] :Fentry
# | [var_ref] :VarRef # | [var_ref] :VarRef
c_inline::expr_interpret inline::expr_interpret
{ {
InlineItem *inlineItem; InlineItem *inlineItem;
} }
c_inline::expr_interpret :Fpc inline::expr_interpret :Fpc
{ {
$$->inlineItem = new InlineItem( @1, InlineItem::PChar ); $$->inlineItem = new InlineItem( @1, InlineItem::PChar );
} }
c_inline::expr_interpret :Fc inline::expr_interpret :Fc
{ {
$$->inlineItem = new InlineItem( @1, InlineItem::Char ); $$->inlineItem = new InlineItem( @1, InlineItem::Char );
} }
c_inline::expr_interpret :Fcurs inline::expr_interpret :Fcurs
{ {
$$->inlineItem = new InlineItem( @1, InlineItem::Curs ); $$->inlineItem = new InlineItem( @1, InlineItem::Curs );
} }
c_inline::expr_interpret :Ftargs inline::expr_interpret :Ftargs
{ {
$$->inlineItem = new InlineItem( @1, InlineItem::Targs ); $$->inlineItem = new InlineItem( @1, InlineItem::Targs );
} }
c_inline::expr_interpret :Fentry inline::expr_interpret :Fentry
{ {
$$->inlineItem = new InlineItem( @1, $state_ref->nameRef, InlineI tem::Entry ); $$->inlineItem = new InlineItem( @1, $state_ref->nameRef, InlineI tem::Entry );
} }
c_inline::expr_interpret :VarRef inline::expr_interpret :VarRef
{ {
string data( $1->data + 1, $1->length - 1 ); string data( $1->data + 1, $1->length - 1 );
$$->inlineItem = new InlineItem( @1, InlineItem::Subst ); $$->inlineItem = new InlineItem( @1, InlineItem::Subst );
ActionParamList::Iter api = *paramList; ActionParamList::Iter api = *paramList;
for ( ; api.lte(); api++ ) { for ( ; api.lte(); api++ ) {
if ( (*api)->name == data ) if ( (*api)->name == data )
break; break;
} }
skipping to change at line 2482 skipping to change at line 2502
} }
ragel::write_arg :Word ragel::write_arg :Word
{ {
string arg( $word->data, $word->length ); string arg( $word->data, $word->length );
writeArgs.push_back( arg ); writeArgs.push_back( arg );
} }
# Pass Through. # Pass Through.
# def tok # def tok
# [ident] :Ident # [`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 # | [number] :Number
# | [hex_number] :HexNumber # | [hex_number] :HexNumber
# | [comment] :Comment # | [comment] :Comment
# | [string] :String # | [string] :String
# | [whitespace] :Whitespace # | [whitespace] :Whitespace
# | [c_any] :Any # | [c_any] :Any
c_host::tok :Ident
host::tok :ImportDefNum
{ {
if ( includeDepth == 0 ) if ( isImport )
id->curItem->data.write( $ident->data, $ident->length ); {
} Literal *lit = new Literal( @number,
false /* $number->neg */, $number->data,
$number->length, Literal::Number );
c_host::tok :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->le
ngth );
id->curItem->data.write( " ", 1 );
id->curItem->data.write( $number->data, $number->
length );
}
}
}
host::tok :ImportDefStr
{ {
if ( includeDepth == 0 ) if ( isImport )
id->curItem->data.write( $number->data, $number->length ) {
; Literal *lit = new Literal( @string, false,
$string->data, $string->length, Literal::
LitString );
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->le
ngth );
id->curItem->data.write( " ", 1 );
id->curItem->data.write( $string->data, $string->
length );
}
}
} }
host::tok :ImportAssignNum
c_host::tok :HexNumber
{ {
if ( includeDepth == 0 ) if ( isImport )
id->curItem->data.write( $hex_number->data, $hex_number-> {
length ); 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( $ident->data, $ident->le
ngth );
id->curItem->data.write( "=", 1 );
id->curItem->data.write( $number->data, $number->
length );
}
}
} }
host::tok :ImportAssignStr
c_host::tok :Comment
{ {
if ( includeDepth == 0 ) if ( isImport )
id->curItem->data.write( $comment->data, $comment->length {
); Literal *lit = new Literal( @string, false,
$string->data, $string->length, Literal::
LitString );
string name( $ident->data, $ident->length );
import( @ident, name, lit );
}
else
{
if ( includeDepth == 0 ) {
id->curItem->data.write( $ident->data, $ident->le
ngth );
id->curItem->data.write( "=", 1 );
id->curItem->data.write( $string->data, $string->
length );
}
}
} }
host::tok :Def
{
if ( !isImport && includeDepth == 0 )
id->curItem->data.write( "define", 6 );
c_host::tok :String }
host::tok :Eq
{ {
if ( includeDepth == 0 ) if ( !isImport && includeDepth == 0 )
id->curItem->data.write( $string->data, $string->length ) id->curItem->data.write( "=", 1 );
;
} }
c_host::tok :Whitespace host::tok :Ident
{ {
if ( includeDepth == 0 ) if ( !isImport && includeDepth == 0 )
id->curItem->data.write( $whitespace->data, $whitespace-> id->curItem->data.write( $ident->data, $ident->length );
length );
} }
c_host::tok :Any host::tok :Number
{ {
if ( includeDepth == 0 ) if ( !isImport && includeDepth == 0 )
id->curItem->data.write( $c_any->data, $c_any->length ); id->curItem->data.write( $number->data, $number->length )
;
} }
c_host::section :MultiLine host::tok :HexNumber
{ {
if ( includeDepth == 0 ) { if ( !isImport && includeDepth == 0 )
id->curItem = id->curItem->next; id->curItem->data.write( $hex_number->data, $hex_number->
id->curItem->pd = pd; length );
bool success = id->checkLastRef( id->curItem );
if ( ! success ) {
pda_run->fail_parsing = 1;
this->success = false;
}
id->curItem = id->curItem->next;
}
} }
end
#
# The section pass will collect the list of input items and the unique
# sections. This allows us to free compilation resources as we go forward with
# the parsing pass. We can identify the last known reference to a particular
# section.
#
# In the parsing pass we iterate the input item list created here.
#
reduction SectionPass host::tok :Comment
ragel::machine_name :MachineName
{ {
string machine( $word->data, $word->length ); if ( !isImport && includeDepth == 0 )
id->curItem->data.write( $comment->data, $comment->length
SectionDictEl *sdEl = id->sectionDict.find( machine ); );
if ( sdEl == 0 ) {
sdEl = new SectionDictEl( machine );
sdEl->value = new Section( machine );
id->sectionDict.insert( sdEl );
id->sectionList.append( sdEl->value );
}
section = sdEl->value;
} }
ragel::statement :Write host::tok :String
{ {
InputItem *inputItem = new InputItem; if ( !isImport && includeDepth == 0 )
inputItem->type = InputItem::Write; id->curItem->data.write( $string->data, $string->length )
inputItem->loc = @Cmd; ;
inputItem->name = section->sectionName;
inputItem->section = section;
id->inputItems.append( inputItem );
} }
c_host::section :MultiLine host::tok :Whitespace
{ {
InputItem *inputItem = new InputItem; if ( !isImport && includeDepth == 0 )
inputItem->type = InputItem::EndSection; id->curItem->data.write( $whitespace->data, $whitespace->
inputItem->loc = @3; length );
id->inputItems.append( inputItem );
if ( section != 0 ) {
inputItem->section = section;
section->lastReference = inputItem;
}
/* The end section may include a newline on the end, so
* we use the last line, which will count the newline. */
inputItem = new InputItem;
inputItem->type = InputItem::HostData;
inputItem->loc = @3;
if ( inputItem->loc.fileName == 0 )
inputItem->loc = @1;
id->inputItems.append( inputItem );
} }
end
reduction IncludePass host::tok :Any
ragel::machine_name :MachineName
{ {
sectionMachine = string( $word->data, $word->length ); if ( !isImport && includeDepth == 0 )
id->curItem->data.write( $c_any->data, $c_any->length );
} }
c_host::section :MultiLine host::section :MultiLine
{ {
if ( sectionMachine.size() > 0 && sectionMachine == targetMachine if ( !isImport && includeDepth == 0 ) {
) { InputItem *inputItem = new InputItem;
IncItem *incItem = new IncItem; inputItem->type = InputItem::EndSection;
incItem->loc = @1; inputItem->loc = @5;
id->inputItems.append( inputItem );
if ( section != 0 ) {
inputItem->section = section;
section->lastReference = inputItem;
}
/* The end section may include a newline on the end, so
* we use the last line, which will count the newline. */
inputItem = new InputItem;
inputItem->type = InputItem::HostData;
inputItem->loc = @5;
if ( inputItem->loc.fileName == 0 )
inputItem->loc = @1;
/* The locations are token starts. Include the trailing } id->inputItems.append( inputItem );
%% token. */
incItem->start = @1->byte;
incItem->end = @3->byte + $3->length;
incItem->length = incItem->end - incItem->start;
incItem->section = section; /* Record the parse data and move over the end section. *
incItems.append( incItem ); /
id->curItem = id->curItem->next;
id->curItem->pd = pd;
/* Move over the host data. */
id->curItem = id->curItem->next;
} }
} }
end end
 End of changes. 113 change blocks. 
196 lines changed or deleted 262 lines changed or added

Home  |  About  |  All  |  Newest  |  Fossies Dox  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTPS