"Fossies" - the Fresh Open Source Software Archive  

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

About: Ragel compiles executable finite state machines from regular languages (C, C++, Obj-C, C#, D, Java, Go and Ruby). Development version.

reducer.lm  (ragel-7.0.0.10):reducer.lm  (ragel-7.0.0.11)
reduction TopLevel reduction TopLevel
# def machine_name # def machine_name
# [`machine word `;] :MachineName # [`machine word `;] :MachineName
ragel::machine_name :MachineName ragel::machine_name :MachineName
{ {
string machine( $mn_word->data, $mn_word->length ); string machine( $mn_word->data, $mn_word->length );
if ( includeDepth == 0 ) { if ( includeDepth == 0 ) {
/* Maintain section dict, section list and the cur sectio n pointer /* Maintain section dict, section list and the cur sectio n pointer
* if we are in the top level. */ * if we are in the top level. */
SectionDictEl *sdEl = id->sectionDict.find( machine ); SectionDictEl *sdEl = id->sectionDict.find( machine );
if ( sdEl == 0 ) { if ( sdEl == 0 ) {
sdEl = new SectionDictEl( machine ); sdEl = new SectionDictEl( machine );
sdEl->value = new Section( machine ); sdEl->value = new Section( machine );
id->sectionDict.insert( sdEl ); id->sectionDict.insert( sdEl );
id->sectionList.append( sdEl->value ); id->sectionList.append( sdEl->value );
} }
section = sdEl->value; section = sdEl->value;
}
if ( includeDepth > 0 ) { ParseDataDictEl *pdEl = id->parseDataDict.find( machine )
/* If including, check if the the machine is the one we a ;
re if ( pdEl == 0 ) {
* searching for. If not, reset pd. Otherwise, rename it InputLoc sectionLoc = @1;
to target pdEl = new ParseDataDictEl( machine );
* machine because we are drawing the statements into tar pdEl->value = new ParseData( id, machine,
get. */ id->nextMachineId++, sectionLoc,
if ( machine == searchMachine ) hostLang,
machine = targetMachine; minimizeLevel, minimizeOpt );
} id->parseDataDict.insert( pdEl );
id->parseDataList.append( pdEl->value );
ParseDataDictEl *pdEl = id->parseDataDict.find( machine ); }
if ( pdEl == 0 ) {
InputLoc sectionLoc = @1;
pdEl = new ParseDataDictEl( machine );
pdEl->value = new ParseData( id, machine,
id->nextMachineId++, sectionLoc, hostLang
,
minimizeLevel, minimizeOpt );
id->parseDataDict.insert( pdEl );
id->parseDataList.append( pdEl->value );
}
pd = pdEl->value; pd = pdEl->value;
}
} }
# def statement # def statement
# [assignment] :Assignment # [assignment] :Assignment
# | [instantiation] :Instantiation # | [instantiation] :Instantiation
# | [nfa_union] :NfaUnion # | [nfa_union] :NfaUnion
# | [action_spec] :ActionSpec # | [action_spec] :ActionSpec
# | [`prepush action_block] :PrePush commit # | [`prepush action_block] :PrePush commit
# | [`postpop action_block] :PostPop commit # | [`postpop action_block] :PostPop commit
# | [`nfaprepush action_block] :NfaPrePush commit # | [`nfaprepush action_block] :NfaPrePush commit
skipping to change at line 326 skipping to change at line 317
string two( $W2->data, $W2->length ); string two( $W2->data, $W2->length );
if ( ! pd->setAlphType( @W1, hostLang, one.c_str(), two.c_str() ) ) { if ( ! pd->setAlphType( @W1, hostLang, one.c_str(), two.c_str() ) ) {
// Recover by ignoring the alphtype statement. // Recover by ignoring the alphtype statement.
pd->id->error(@W1) << "\"" << one << pd->id->error(@W1) << "\"" << one <<
"\" is not a valid alphabet type" << endl ; "\" is not a valid alphabet type" << endl ;
} }
} }
# def statement # def statement
# | [`getkey inline_expr_reparse] :GetKey commit # | [`getkey inline_expr_reparse] :GetKey commit
# | [`import string `;] :Import commit
ragel::statement :GetKey ragel::statement :GetKey
{ {
pd->fsmCtx->getKeyExpr = $inline_expr_reparse->inlineList; pd->fsmCtx->getKeyExpr = $inline_expr_reparse->inlineList;
} }
ragel::statement :Import ragel::open_inc :OpenInc
{
InputLoc loc = @string;
std::string fileName( $string->data, $string->length );
long length;
bool caseInsensitive;
char *unescaped = prepareLitString( pd->id, loc,
fileName.c_str(), fileName.size(),
length, caseInsensitive );
importFile( unescaped );
}
# def statement
# [`include include_spec `;] :Include commit
ragel::statement :Include
{
string fileName = id->inputFileName;
string machine = pd->sectionName;
bool fileSpecified = false;
if ( $include_spec->file.data != 0 ) {
fileName = string( $include_spec->file.data, $include_spe
c->file.length );
InputLoc loc = $include_spec->file.loc;
long length;
bool caseInsensitive;
char *unescaped = prepareLitString( pd->id, loc, fileName
.c_str(), fileName.size(),
length, caseInsensitive );
fileName = unescaped;
fileSpecified = true;
}
if ( $include_spec->machine.data != 0 )
machine = string( $include_spec->machine.data, $include_s
pec->machine.length );
include( @1, fileSpecified, fileName, machine );
}
# def include_spec
# [word] :Machine
# | [string] :File
# | [word string] :MachineFile
ragel::include_spec
{ {
RedToken machine; includeDepth += 1;
RedToken file;
} }
ragel::include_spec :Machine ragel::close_inc :CloseInc
{ {
$$->machine.set( $word, @word ); includeDepth -= 1;
$$->file.data = 0;
} }
ragel::include_spec :File ragel::open_imp :OpenImp
{ {
$$->file.set( $string, @string ); isImport = true;
$$->machine.data = 0;
} }
ragel::include_spec :MachineFile ragel::close_imp :CloseImp
{ {
$$->machine.set( $word, @word ); isImport = false;
$$->file.set( $string, @string );
} }
# def join # def join
# [join `, expression] :Rec # [join `, expression] :Rec
# | [expression] :Base # | [expression] :Base
ragel::join ragel::join
{ {
Join *join; Join *join;
} }
skipping to change at line 927 skipping to change at line 867
colm_location loc; colm_location loc;
InlineList *inlineList; InlineList *inlineList;
} }
ragel::action_expr :ActionExpr ragel::action_expr :ActionExpr
{ {
$$->loc = *@1; $$->loc = *@1;
$$->inlineList = $CInlineExpr->inlineList; $$->inlineList = $CInlineExpr->inlineList;
} }
# def inline_block
# [block_item_list] :List
inline::inline_block
{
InlineList *inlineList;
}
inline::inline_block :List
{
$$->inlineList = $block_item_list->inlineList;
}
# def block_item_list
# [block_item block_item_list] :Rec
# | [] :Base
inline::block_item_list
{
InlineList *inlineList;
}
inline::block_item_list :Rec
{
$$->inlineList = $_block_item_list->inlineList;
if ( $block_item->inlineItem != 0 )
$$->inlineList->prepend( $block_item->inlineItem );
else if ( $block_item->inlineList != 0 ) {
$$->inlineList->prepend( *$block_item->inlineList );
delete $block_item->inlineList;
}
}
inline::block_item_list :Base
{
$$->inlineList = new InlineList;
}
# def block_item
# [expr_any] :ExprAny
# | [block_symbol] :BlockSymbol
# | [block_interpret] :BlockInterpret
# | [`{ inline_block `}] :RecBlock
inline::block_item
{
InlineItem *inlineItem;
InlineList *inlineList;
}
inline::block_item :ExprAny
{
$$->inlineItem = $expr_any->inlineItem;
}
inline::block_item :BlockSymbol
{
$$->inlineItem = $block_symbol->inlineItem;
}
inline::block_item :BlockInterpret
{
$$->inlineItem = $block_interpret->inlineItem;
}
inline::block_item :RecBlock
{
$$->inlineList = $inline_block->inlineList;
$$->inlineList->prepend( new InlineItem( @1, "{", InlineItem::Tex
t ) );
$$->inlineList->append( new InlineItem( @1, "}", InlineItem::Text
) );
$$->inlineItem = 0;
}
# def expr_any
# [whitespace] :WS
#| [comment] :Comment
#| [string] :String
#| [number] :Number
#| [hex_number] :Hex
#| [ident] :Ident
#| [c_any] :Any
inline::expr_any
{
InlineItem *inlineItem;
}
inline::expr_any :WS
{
string data( $whitespace->data, $whitespace->length );
$$->inlineItem = new InlineItem( @whitespace, data, InlineItem::T
ext );
}
inline::expr_any :Comment
{
string data( $comment->data, $comment->length );
$$->inlineItem = new InlineItem( @comment, data, InlineItem::Text
);
}
inline::expr_any :String
{
string data( $string->data, $string->length );
$$->inlineItem = new InlineItem( @string, data, InlineItem::Text
);
}
inline::expr_any :Number
{
string data( $number->data, $number->length );
$$->inlineItem = new InlineItem( @number, data, InlineItem::Text
);
}
inline::expr_any :Hex
{
string data( $hex_number->data, $hex_number->length );
$$->inlineItem = new InlineItem( @hex_number, data, InlineItem::T
ext );
}
inline::expr_any :Ident
{
string data( $ident->data, $ident->length );
$$->inlineItem = new InlineItem( @ident, data, InlineItem::Text )
;
}
inline::expr_any :Any
{
string data( $c_any->data, $c_any->length );
$$->inlineItem = new InlineItem( @c_any, data, InlineItem::Text )
;
}
# def block_symbol
# [`,] :B1 | [`;] :B2 | [`(] :B3 | [`)] :B4 | [`*] :B5 | [`::] :B6
inline::block_symbol
{
InlineItem *inlineItem;
}
inline::block_symbol :B1
{
string data( $1->data, $1->length );
$$->inlineItem = new InlineItem( @1, data, InlineItem::Text );
}
inline::block_symbol :B2
{
string data( $1->data, $1->length );
$$->inlineItem = new InlineItem( @1, data, InlineItem::Text );
}
inline::block_symbol :B3
{
string data( $1->data, $1->length );
$$->inlineItem = new InlineItem( @1, data, InlineItem::Text );
}
inline::block_symbol :B4
{
string data( $1->data, $1->length );
$$->inlineItem = new InlineItem( @1, data, InlineItem::Text );
}
inline::block_symbol :B5
{
string data( $1->data, $1->length );
$$->inlineItem = new InlineItem( @1, data, InlineItem::Text );
}
inline::block_symbol :B6
{
string data( $1->data, $1->length );
$$->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
state_ref::state_ref state_ref::state_ref
{ {
NameRef *nameRef; NameRef *nameRef;
} }
state_ref::state_ref :Ref state_ref::state_ref :Ref
{ {
$$->nameRef = $state_ref_names->nameRef; $$->nameRef = $state_ref_names->nameRef;
skipping to change at line 1148 skipping to change at line 919
$$->nameRef = $_state_ref_names->nameRef; $$->nameRef = $_state_ref_names->nameRef;
$$->nameRef->append( string( $word->data, $word->length ) ); $$->nameRef->append( string( $word->data, $word->length ) );
} }
state_ref::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 priority_aug
# [expr_interpret] :ExprInterpret # [uint] :NoSign
# | [`fhold whitespace? `;] :Fhold # | [`+ uint] :Plus
# | [`fgoto whitespace? `* inline_expr `;] :FgotoExpr # | [`- uint] :Minus
# | [`fnext whitespace? `* inline_expr `;] :FnextExpr ragel::priority_aug
# | [`fcall whitespace? `* inline_expr `;] :FcallExpr
# | [`fncall whitespace? `* inline_expr `;] :FncallExpr
# | [`fexec inline_expr `;] :Fexec
# | [`fgoto state_ref srlex::`;] :FgotoSr
# | [`fnext state_ref srlex::`;] :FnextSr
# | [`fcall state_ref srlex::`;] :FcallSr
# | [`fncall state_ref srlex::`;] :FncallSr
# | [`fret `;] :Fret
# | [`fnret `;] :Fnret
# | [`fbreak `;] :Fbreak
# | [`fnbreak `;] :Fnbreak
inline::block_interpret
{ {
InlineItem *inlineItem; int priorityNum;
} }
ragel::priority_aug :NoSign
inline::block_interpret :Fhold
{ {
$$->inlineItem = new InlineItem( @1, InlineItem::Hold ); string data( $uint->data, $uint->length );
$$->priorityNum = tryLongScan( @1, data.c_str() );
} }
inline::block_interpret :FgotoExpr ragel::priority_aug :Plus
{ {
$$->inlineItem = new InlineItem( @1, InlineItem::GotoExpr ); string data( $uint->data, $uint->length );
$$->inlineItem->children = $inline_expr->inlineList; $$->priorityNum = tryLongScan( @1, data.c_str() );
} }
inline::block_interpret :FnextExpr ragel::priority_aug :Minus
{ {
$$->inlineItem = new InlineItem( @1, InlineItem::NextExpr ); string data( $uint->data, $uint->length );
$$->inlineItem->children = $inline_expr->inlineList; $$->priorityNum = -1 * tryLongScan( @1, data.c_str() );
} }
inline::block_interpret :FcallExpr
#def priority_name
# [word] :Word
ragel::priority_name
{ {
$$->inlineItem = new InlineItem( @1, InlineItem::CallExpr ); int priorityName;
$$->inlineItem->children = $inline_expr->inlineList;
} }
inline::block_interpret :FncallExpr
ragel::priority_name :Word
{ {
$$->inlineItem = new InlineItem( @1, InlineItem::NcallExpr ); string data( $word->data, $word->length );
$$->inlineItem->children = $inline_expr->inlineList;
} // Lookup/create the priority key.
inline::block_interpret :Fexec PriorDictEl *priorDictEl;
{ if ( pd->priorDict.insert( data, pd->fsmCtx->nextPriorKey, &prior
$$->inlineItem = new InlineItem( @1, InlineItem::Exec ); DictEl ) )
$$->inlineItem->children = $inline_expr->inlineList; pd->fsmCtx->nextPriorKey += 1;
}
inline::block_interpret :FgotoSr // Use the inserted/found priority key.
{ $$->priorityName = priorDictEl->value;
$$->inlineItem = new InlineItem( @1,
$state_ref->nameRef, InlineItem::Goto );
}
inline::block_interpret :FnextSr
{
$$->inlineItem = new InlineItem( @1,
$state_ref->nameRef, InlineItem::Next );
}
inline::block_interpret :FcallSr
{
$$->inlineItem = new InlineItem( @1,
$state_ref->nameRef, InlineItem::Call );
}
inline::block_interpret :FncallSr
{
$$->inlineItem = new InlineItem( @1,
$state_ref->nameRef, InlineItem::Ncall );
}
inline::block_interpret :Fret
{
$$->inlineItem = new InlineItem( @1, InlineItem::Ret );
}
inline::block_interpret :Fnret
{
$$->inlineItem = new InlineItem( @1, InlineItem::Nret );
}
inline::block_interpret :Fbreak
{
$$->inlineItem = new InlineItem( @1, InlineItem::Break );
}
inline::block_interpret :Fnbreak
{
$$->inlineItem = new InlineItem( @1, InlineItem::Nbreak );
}
inline::block_interpret :ExprInterpret
{
$$->inlineItem = $expr_interpret->inlineItem;
}
# def inline_expr
# [expr_item_list] :List
inline::inline_expr
{
InlineList *inlineList;
}
inline::inline_expr :List
{
$$->inlineList = $expr_item_list->inlineList;
}
# def expr_item_list
# [expr_item_list expr_item] :Rec
# | [] :Empty
inline::expr_item_list
{
InlineList *inlineList;
}
inline::expr_item_list :Rec
{
$$->inlineList = $_expr_item_list->inlineList;
$$->inlineList->append( $expr_item->inlineItem );
}
inline::expr_item_list :Empty
{
$$->inlineList = new InlineList;
}
# def expr_item
# [expr_any] :ExprAny
# | [expr_symbol] :ExprSymbol
# | [expr_interpret] :ExprInterpret
inline::expr_item
{
InlineItem *inlineItem;
}
inline::expr_item :ExprAny
{
$$->inlineItem = $expr_any->inlineItem;
}
inline::expr_item :ExprSymbol
{
string sym( $expr_symbol->sym );
$$->inlineItem = new InlineItem( &$expr_symbol->loc, sym, InlineI
tem::Text );
}
inline::expr_item :ExprInterpret
{
$$->inlineItem = $expr_interpret->inlineItem;
}
# def expr_symbol
# [`,] | [`(] | [`)] | [`*] | [`::]
inline::expr_symbol
{
const char *sym;
colm_location loc;
}
inline::expr_symbol :Comma
{ $$->loc = *@1; $$->sym = ","; }
inline::expr_symbol :Open
{ $$->loc = *@1; $$->sym = "("; }
inline::expr_symbol :Close
{ $$->loc = *@1; $$->sym = ")"; }
inline::expr_symbol :Star
{ $$->loc = *@1; $$->sym = "*"; }
inline::expr_symbol :DoubleColon
{ $$->loc = *@1; $$->sym = "::"; }
# def expr_interpret
# [`fpc] :Fpc
# | [`fc] :Fc
# | [`fcurs] :Fcurs
# | [`ftargs] :Ftargs
# | [`fentry `( state_ref srlex::`)] :Fentry
# | [var_ref] :VarRef
inline::expr_interpret
{
InlineItem *inlineItem;
}
inline::expr_interpret :Fpc
{
$$->inlineItem = new InlineItem( @1, InlineItem::PChar );
}
inline::expr_interpret :Fc
{
$$->inlineItem = new InlineItem( @1, InlineItem::Char );
}
inline::expr_interpret :Fcurs
{
$$->inlineItem = new InlineItem( @1, InlineItem::Curs );
}
inline::expr_interpret :Ftargs
{
$$->inlineItem = new InlineItem( @1, InlineItem::Targs );
}
inline::expr_interpret :Fentry
{
$$->inlineItem = new InlineItem( @1, $state_ref->nameRef, InlineI
tem::Entry );
}
inline::expr_interpret :VarRef
{
string data( $1->data + 1, $1->length - 1 );
$$->inlineItem = new InlineItem( @1, InlineItem::Subst );
ActionParamList::Iter api = *paramList;
for ( ; api.lte(); api++ ) {
if ( (*api)->name == data )
break;
}
if ( api.end() )
pd->id->error( @1 ) << "invalid parameter reference \"$"
<< $1->data << "\"" << endl;
else {
$$->inlineItem->substPos = api.pos();
}
}
# def priority_aug
# [uint] :NoSign
# | [`+ uint] :Plus
# | [`- uint] :Minus
ragel::priority_aug
{
int priorityNum;
}
ragel::priority_aug :NoSign
{
string data( $uint->data, $uint->length );
$$->priorityNum = tryLongScan( @1, data.c_str() );
}
ragel::priority_aug :Plus
{
string data( $uint->data, $uint->length );
$$->priorityNum = tryLongScan( @1, data.c_str() );
}
ragel::priority_aug :Minus
{
string data( $uint->data, $uint->length );
$$->priorityNum = -1 * tryLongScan( @1, data.c_str() );
}
#def priority_name
# [word] :Word
ragel::priority_name
{
int priorityName;
}
ragel::priority_name :Word
{
string data( $word->data, $word->length );
// Lookup/create the priority key.
PriorDictEl *priorDictEl;
if ( pd->priorDict.insert( data, pd->fsmCtx->nextPriorKey, &prior
DictEl ) )
pd->fsmCtx->nextPriorKey += 1;
// Use the inserted/found priority key.
$$->priorityName = priorDictEl->value;
} }
# def error_name # def error_name
# [word] :Word # [word] :Word
ragel::error_name ragel::error_name
{ {
int errName; int errName;
} }
ragel::error_name :Word ragel::error_name :Word
skipping to change at line 2499 skipping to change at line 2050
ragel::nfa_rounds :Rounds ragel::nfa_rounds :Rounds
{ {
$$->roundsList = $nfa_round_list->roundsList; $$->roundsList = $nfa_round_list->roundsList;
} }
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 );
} }
end
# Pass Through. reduction TopLevel
# def tok # def inline_block
# [`define ident number] :Def1 # [block_item_list] :List
# | [`define ident string] :Def2 inline::inline_block
# | [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 ) InlineList *inlineList;
{
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->le
ngth );
id->curItem->data.write( " ", 1 );
id->curItem->data.write( $number->data, $number->
length );
}
}
} }
host::tok :ImportDefStr
inline::inline_block :List
{ {
if ( isImport ) $$->inlineList = $block_item_list->inlineList;
{
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
# def block_item_list
# [block_item block_item_list] :Rec
# | [] :Base
inline::block_item_list
{ {
if ( isImport ) InlineList *inlineList;
{
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
inline::block_item_list :Rec
{ {
if ( isImport ) $$->inlineList = $_block_item_list->inlineList;
{
Literal *lit = new Literal( @string, false,
$string->data, $string->length, Literal::
LitString );
string name( $ident->data, $ident->length ); if ( $block_item->inlineItem != 0 )
import( @ident, name, lit ); $$->inlineList->prepend( $block_item->inlineItem );
} else if ( $block_item->inlineList != 0 ) {
else $$->inlineList->prepend( *$block_item->inlineList );
{ delete $block_item->inlineList;
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
inline::block_item_list :Base
{ {
if ( !isImport && includeDepth == 0 ) $$->inlineList = new InlineList;
id->curItem->data.write( "define", 6 ); }
# def block_item
# [expr_any] :ExprAny
# | [block_symbol] :BlockSymbol
# | [block_interpret] :BlockInterpret
# | [`{ inline_block `}] :RecBlock
inline::block_item
{
InlineItem *inlineItem;
InlineList *inlineList;
} }
host::tok :Eq
inline::block_item :ExprAny
{ {
if ( !isImport && includeDepth == 0 ) $$->inlineItem = $expr_any->inlineItem;
id->curItem->data.write( "=", 1 );
} }
host::tok :Ident inline::block_item :BlockSymbol
{ {
if ( !isImport && includeDepth == 0 ) $$->inlineItem = $block_symbol->inlineItem;
id->curItem->data.write( $ident->data, $ident->length );
} }
host::tok :Number inline::block_item :BlockInterpret
{ {
if ( !isImport && includeDepth == 0 ) $$->inlineItem = $block_interpret->inlineItem;
id->curItem->data.write( $number->data, $number->length )
;
} }
host::tok :HexNumber inline::block_item :RecBlock
{ {
if ( !isImport && includeDepth == 0 ) $$->inlineList = $inline_block->inlineList;
id->curItem->data.write( $hex_number->data, $hex_number-> $$->inlineList->prepend( new InlineItem( @1, "{", InlineItem::Tex
length ); t ) );
$$->inlineList->append( new InlineItem( @1, "}", InlineItem::Text
) );
$$->inlineItem = 0;
} }
host::tok :Comment # def expr_any
# [whitespace] :WS
#| [comment] :Comment
#| [string] :String
#| [number] :Number
#| [hex_number] :Hex
#| [ident] :Ident
#| [c_any] :Any
inline::expr_any
{ {
if ( !isImport && includeDepth == 0 ) InlineItem *inlineItem;
id->curItem->data.write( $comment->data, $comment->length
);
} }
host::tok :String inline::expr_any :WS
{ {
if ( !isImport && includeDepth == 0 ) string data( $whitespace->data, $whitespace->length );
id->curItem->data.write( $string->data, $string->length ) $$->inlineItem = new InlineItem( @whitespace, data, InlineItem::T
; ext );
} }
host::tok :Whitespace inline::expr_any :Comment
{ {
if ( !isImport && includeDepth == 0 ) string data( $comment->data, $comment->length );
id->curItem->data.write( $whitespace->data, $whitespace-> $$->inlineItem = new InlineItem( @comment, data, InlineItem::Text
length ); );
} }
host::tok :Any inline::expr_any :String
{ {
if ( !isImport && includeDepth == 0 ) string data( $string->data, $string->length );
id->curItem->data.write( $c_any->data, $c_any->length ); $$->inlineItem = new InlineItem( @string, data, InlineItem::Text
);
} }
host::section :MultiLine inline::expr_any :Number
{ {
if ( !isImport && includeDepth == 0 ) { string data( $number->data, $number->length );
InputItem *inputItem = new InputItem; $$->inlineItem = new InlineItem( @number, data, InlineItem::Text
inputItem->type = InputItem::EndSection; );
inputItem->loc = @5; }
id->inputItems.append( inputItem );
if ( section != 0 ) { inline::expr_any :Hex
inputItem->section = section; {
section->lastReference = inputItem; string data( $hex_number->data, $hex_number->length );
} $$->inlineItem = new InlineItem( @hex_number, data, InlineItem::T
ext );
}
/* The end section may include a newline on the end, so inline::expr_any :Ident
* we use the last line, which will count the newline. */ {
inputItem = new InputItem; string data( $ident->data, $ident->length );
inputItem->type = InputItem::HostData; $$->inlineItem = new InlineItem( @ident, data, InlineItem::Text )
inputItem->loc = @5; ;
if ( inputItem->loc.fileName == 0 ) }
inputItem->loc = @1;
id->inputItems.append( inputItem ); inline::expr_any :Any
{
string data( $c_any->data, $c_any->length );
$$->inlineItem = new InlineItem( @c_any, data, InlineItem::Text )
;
}
/* Record the parse data and move over the end section. * # def block_symbol
/ # [`,] :B1 | [`;] :B2 | [`(] :B3 | [`)] :B4 | [`*] :B5 | [`::] :B6
id->curItem = id->curItem->next; inline::block_symbol
id->curItem->pd = pd; {
InlineItem *inlineItem;
}
/* Move over the host data. */ inline::block_symbol :B1
id->curItem = id->curItem->next; {
string data( $1->data, $1->length );
$$->inlineItem = new InlineItem( @1, data, InlineItem::Text );
}
inline::block_symbol :B2
{
string data( $1->data, $1->length );
$$->inlineItem = new InlineItem( @1, data, InlineItem::Text );
}
inline::block_symbol :B3
{
string data( $1->data, $1->length );
$$->inlineItem = new InlineItem( @1, data, InlineItem::Text );
}
inline::block_symbol :B4
{
string data( $1->data, $1->length );
$$->inlineItem = new InlineItem( @1, data, InlineItem::Text );
}
inline::block_symbol :B5
{
string data( $1->data, $1->length );
$$->inlineItem = new InlineItem( @1, data, InlineItem::Text );
}
inline::block_symbol :B6
{
string data( $1->data, $1->length );
$$->inlineItem = new InlineItem( @1, data, InlineItem::Text );
}
# def block_interpret
# [expr_interpret] :ExprInterpret
# | [`fhold whitespace? `;] :Fhold
# | [`fgoto whitespace? `* inline_expr `;] :FgotoExpr
# | [`fnext whitespace? `* inline_expr `;] :FnextExpr
# | [`fcall whitespace? `* inline_expr `;] :FcallExpr
# | [`fncall whitespace? `* inline_expr `;] :FncallExpr
# | [`fexec inline_expr `;] :Fexec
# | [`fgoto state_ref srlex::`;] :FgotoSr
# | [`fnext state_ref srlex::`;] :FnextSr
# | [`fcall state_ref srlex::`;] :FcallSr
# | [`fncall state_ref srlex::`;] :FncallSr
# | [`fret `;] :Fret
# | [`fnret `;] :Fnret
# | [`fbreak `;] :Fbreak
# | [`fnbreak `;] :Fnbreak
inline::block_interpret
{
InlineItem *inlineItem;
}
inline::block_interpret :Fhold
{
$$->inlineItem = new InlineItem( @1, InlineItem::Hold );
}
inline::block_interpret :FgotoExpr
{
$$->inlineItem = new InlineItem( @1, InlineItem::GotoExpr );
$$->inlineItem->children = $inline_expr->inlineList;
}
inline::block_interpret :FnextExpr
{
$$->inlineItem = new InlineItem( @1, InlineItem::NextExpr );
$$->inlineItem->children = $inline_expr->inlineList;
}
inline::block_interpret :FcallExpr
{
$$->inlineItem = new InlineItem( @1, InlineItem::CallExpr );
$$->inlineItem->children = $inline_expr->inlineList;
}
inline::block_interpret :FncallExpr
{
$$->inlineItem = new InlineItem( @1, InlineItem::NcallExpr );
$$->inlineItem->children = $inline_expr->inlineList;
}
inline::block_interpret :Fexec
{
$$->inlineItem = new InlineItem( @1, InlineItem::Exec );
$$->inlineItem->children = $inline_expr->inlineList;
}
inline::block_interpret :FgotoSr
{
$$->inlineItem = new InlineItem( @1,
$state_ref->nameRef, InlineItem::Goto );
}
inline::block_interpret :FnextSr
{
$$->inlineItem = new InlineItem( @1,
$state_ref->nameRef, InlineItem::Next );
}
inline::block_interpret :FcallSr
{
$$->inlineItem = new InlineItem( @1,
$state_ref->nameRef, InlineItem::Call );
}
inline::block_interpret :FncallSr
{
$$->inlineItem = new InlineItem( @1,
$state_ref->nameRef, InlineItem::Ncall );
}
inline::block_interpret :Fret
{
$$->inlineItem = new InlineItem( @1, InlineItem::Ret );
}
inline::block_interpret :Fnret
{
$$->inlineItem = new InlineItem( @1, InlineItem::Nret );
}
inline::block_interpret :Fbreak
{
$$->inlineItem = new InlineItem( @1, InlineItem::Break );
}
inline::block_interpret :Fnbreak
{
$$->inlineItem = new InlineItem( @1, InlineItem::Nbreak );
}
inline::block_interpret :ExprInterpret
{
$$->inlineItem = $expr_interpret->inlineItem;
}
# def inline_expr
# [expr_item_list] :List
inline::inline_expr
{
InlineList *inlineList;
}
inline::inline_expr :List
{
$$->inlineList = $expr_item_list->inlineList;
}
# def expr_item_list
# [expr_item_list expr_item] :Rec
# | [] :Empty
inline::expr_item_list
{
InlineList *inlineList;
}
inline::expr_item_list :Rec
{
$$->inlineList = $_expr_item_list->inlineList;
$$->inlineList->append( $expr_item->inlineItem );
}
inline::expr_item_list :Empty
{
$$->inlineList = new InlineList;
}
# def expr_item
# [expr_any] :ExprAny
# | [expr_symbol] :ExprSymbol
# | [expr_interpret] :ExprInterpret
inline::expr_item
{
InlineItem *inlineItem;
}
inline::expr_item :ExprAny
{
$$->inlineItem = $expr_any->inlineItem;
}
inline::expr_item :ExprSymbol
{
string sym( $expr_symbol->sym );
$$->inlineItem = new InlineItem( &$expr_symbol->loc, sym, InlineI
tem::Text );
}
inline::expr_item :ExprInterpret
{
$$->inlineItem = $expr_interpret->inlineItem;
}
# def expr_symbol
# [`,] | [`(] | [`)] | [`*] | [`::]
inline::expr_symbol
{
const char *sym;
colm_location loc;
}
inline::expr_symbol :Comma
{ $$->loc = *@1; $$->sym = ","; }
inline::expr_symbol :Open
{ $$->loc = *@1; $$->sym = "("; }
inline::expr_symbol :Close
{ $$->loc = *@1; $$->sym = ")"; }
inline::expr_symbol :Star
{ $$->loc = *@1; $$->sym = "*"; }
inline::expr_symbol :DoubleColon
{ $$->loc = *@1; $$->sym = "::"; }
# def expr_interpret
# [`fpc] :Fpc
# | [`fc] :Fc
# | [`fcurs] :Fcurs
# | [`ftargs] :Ftargs
# | [`fentry `( state_ref srlex::`)] :Fentry
# | [var_ref] :VarRef
inline::expr_interpret
{
InlineItem *inlineItem;
}
inline::expr_interpret :Fpc
{
$$->inlineItem = new InlineItem( @1, InlineItem::PChar );
}
inline::expr_interpret :Fc
{
$$->inlineItem = new InlineItem( @1, InlineItem::Char );
}
inline::expr_interpret :Fcurs
{
$$->inlineItem = new InlineItem( @1, InlineItem::Curs );
}
inline::expr_interpret :Ftargs
{
$$->inlineItem = new InlineItem( @1, InlineItem::Targs );
}
inline::expr_interpret :Fentry
{
$$->inlineItem = new InlineItem( @1, $state_ref->nameRef, InlineI
tem::Entry );
}
inline::expr_interpret :VarRef
{
string data( $1->data + 1, $1->length - 1 );
$$->inlineItem = new InlineItem( @1, InlineItem::Subst );
ActionParamList::Iter api = *paramList;
for ( ; api.lte(); api++ ) {
if ( (*api)->name == data )
break;
}
if ( api.end() )
pd->id->error( @1 ) << "invalid parameter reference \"$"
<< $1->data << "\"" << endl;
else {
$$->inlineItem->substPos = api.pos();
} }
} }
end end
 End of changes. 63 change blocks. 
675 lines changed or deleted 413 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)