SCM start_module_;
int hidden_state_;
public:
- vector<int> extra_token_types_;
+ SCM extra_tokens_;
void *lexval_;
Input *lexloc_;
bool is_main_input_;
SCM keyword_list () const;
SCM lookup_identifier (string s);
SCM lookup_identifier_symbol (SCM s);
- void push_extra_token (int token_type);
+ void push_extra_token (int token_type, SCM scm = SCM_UNDEFINED);
void push_chord_state (SCM tab);
void push_figuredbass_state ();
void push_lyric_state ();
yyless (0);
/* produce requested token */
- int type = extra_token_types_.back ();
- extra_token_types_.pop_back ();
- if (extra_token_types_.empty ())
+ int type = scm_to_int (scm_caar (extra_tokens_));
+ yylval.scm = scm_cdar (extra_tokens_);
+ extra_tokens_ = scm_cdr (extra_tokens_);
+ if (scm_is_null (extra_tokens_))
yy_pop_state ();
return type;
/* Generate a token without swallowing anything */
/* produce requested token */
- int type = extra_token_types_.back ();
- extra_token_types_.pop_back ();
- if (extra_token_types_.empty ())
+ int type = scm_to_int (scm_caar (extra_tokens_));
+ yylval.scm = scm_cdar (extra_tokens_);
+ extra_tokens_ = scm_cdr (extra_tokens_);
+ if (scm_is_null (extra_tokens_))
yy_pop_state ();
return type;
/* Make the lexer generate a token of the given type as the next token.
TODO: make it possible to define a value for the token as well */
void
-Lily_lexer::push_extra_token (int token_type)
+Lily_lexer::push_extra_token (int token_type, SCM scm)
{
- if (extra_token_types_.empty ())
+ if (scm_is_null (extra_tokens_))
{
if (YY_START != extratoken)
hidden_state_ = YY_START;
yy_push_state (extratoken);
}
- extra_token_types_.push_back (token_type);
+ extra_tokens_ = scm_acons (scm_from_int (token_type), scm, extra_tokens_);
}
void
is_main_input_ = false;
start_module_ = SCM_EOL;
chord_repetition_ = Chord_repetition ();
+ extra_tokens_ = SCM_EOL;
smobify_self ();
add_scope (ly_make_module (false));
is_main_input_ = src.is_main_input_;
scopes_ = SCM_EOL;
+ extra_tokens_ = SCM_EOL;
smobify_self ();
scm_gc_mark (lexer->parser_->self_scm ());
scm_gc_mark (lexer->pitchname_tab_stack_);
scm_gc_mark (lexer->start_module_);
+ scm_gc_mark (lexer->extra_tokens_);
return lexer->scopes_;
}