X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=lily%2Fparser.yy;h=50e13b4fa35367c7ecc22b265c57d5a2c2a5d234;hb=a478e5ad057eaf795f915e2b31293e947364d41d;hp=10e1b8df1a817e513033edea21cd0d230985f041;hpb=106e5978fe2fa568bbc6649bc8fcf1134307373a;p=lilypond.git diff --git a/lily/parser.yy b/lily/parser.yy index 10e1b8df1a..bbfaf2438a 100644 --- a/lily/parser.yy +++ b/lily/parser.yy @@ -1,67 +1,80 @@ %{ // -*-Fundamental-*- /* - parser.yy -- Bison/C++ parser for mudela + parser.yy -- Bison/C++ parser for lilypond source file of the GNU LilyPond music typesetter - (c) 1997 Han-Wen Nienhuys + (c) 1997--2000 Han-Wen Nienhuys Jan Nieuwenhuizen */ #include -#include "notename-table.hh" -#include "scalar.hh" -#include "translation-property.hh" -#include "script-def.hh" -#include "symtable.hh" -#include "lookup.hh" +#include "translator-def.hh" +#include "lily-guile.hh" +#include "change-iterator.hh" #include "misc.hh" #include "my-lily-lexer.hh" #include "paper-def.hh" #include "midi-def.hh" #include "main.hh" #include "file-path.hh" -#include "keyword.hh" #include "debug.hh" -#include "parseconstruct.hh" -#include "dimension.hh" -#include "identifier.hh" +#include "dimensions.hh" #include "command-request.hh" #include "musical-request.hh" #include "my-lily-parser.hh" -#include "text-def.hh" -#include "translator-group.hh" +#include "context-specced-music.hh" #include "score.hh" #include "music-list.hh" -#include "header.hh" -#include "duration-convert.hh" -#include "change-translator.hh" +#include "output-property-music-iterator.hh" +#include "property-iterator.hh" #include "file-results.hh" -#include "mudela-version.hh" +#include "input.hh" #include "scope.hh" #include "relative-music.hh" +#include "lyric-combine-music.hh" #include "transposed-music.hh" +#include "time-scaled-music.hh" +#include "repeated-music.hh" +#include "lilypond-input-version.hh" +#include "grace-music.hh" +#include "auto-change-music.hh" +#include "part-combine-music.hh" +#include "scm-hash.hh" + +#include "chord.hh" + +bool +is_duration_b (int t) +{ + return t && t == 1 << intlog2(t); +} -// mmm -Mudela_version oldest_version ("1.0.6"); -Mudela_version version ("1.0.6"); +void +set_music_properties (Music *p, SCM a) +{ + for (SCM k = a; gh_pair_p (k); k = gh_cdr (k)) + { + p->set_mus_property (gh_caar (k), gh_cdar (k)); + } +} -// needed for bison.simple's malloc() and free() -#include -int const GUESS_PLET = 5; -int guess_plet_a[GUESS_PLET] = -{ - 1, - 3, - 2, - 3, - 4 -}; +// mmm JUNKME ? +Lilypond_version oldest_version ("1.3.59"); + +void +print_lilypond_versions (ostream &os) +{ + os << _f ("Oldest supported input version: %s", oldest_version.str ()) + << endl; +} + -Paper_def* current_paper = 0; +// needed for bison.simple's malloc() and free() +#include #ifndef NDEBUG #define YYDEBUG 1 @@ -74,52 +87,34 @@ Paper_def* current_paper = 0; #define THIS ((My_lily_parser *) my_lily_parser_l) #define yyerror THIS->parser_error -#define ARRAY_SIZE(a,s) if (a.size () != s) THIS->parser_error (_f("expecting %d arguments", s)) - +#define ARRAY_SIZE(a,s) if (a.size () != s) THIS->parser_error (_f ("Expecting %d arguments", s)) %} %union { - Array* intarr; - Array *pitch_arr; - Array * strvec; - Array *intvec; - Box *box; - Simultaneous_music *chord; - Duration *duration; - Identifier *id; - Translator* trans; + + Link_array *reqvec; + String * string; Music *music; - Music_list *music_list; Score *score; - Header *header; - Interval *interval; - Lookup*lookup; - + Scope *scope; + Scheme_hash_table *scmhash; Musical_req* musreq; Music_output_def * outputdef; - Musical_pitch * pitch; + Midi_def* midi; - Moment *moment; - Note_req *notereq; - Notename_table *notenametab; - Paper_def *paper; Real real; Request * request; - General_script_def * script; - Scalar *scalar; - String *string; - Atom * symbol; - Symtable * symtable; - Symtables * symtables; - Text_def * textdef; + + /* We use SCMs to do strings, because it saves us the trouble of +deleting them. Let's hope that a stack overflow doesnt trigger a move +of the parse stack onto the heap. */ + + SCM scm; + Tempo_req *tempo; - char c; - const char *consstr; int i; - int pair[2]; - int ii[10]; } %{ @@ -139,219 +134,242 @@ yylex (YYSTYPE *s, void * v_l) %pure_parser /* tokens which are not keywords */ - -%token ABSDYNAMIC +%token AUTOCHANGE +%token APPLY +%token ARPEGGIO +%token DYNAMICSCRIPT +%token TEXTSCRIPT %token ACCEPTS +%token ALTERNATIVE %token BAR -%token BEAMPLET -%token CADENZA +%token BREATHE +%token CHORDMODIFIERS +%token CHORDS +%token CHAR_T %token CLEF %token CM_T %token CONSISTS %token DURATION -%token END +%token SEQUENTIAL +%token ELEMENTDESCRIPTIONS +%token SIMULTANEOUS +%token CONSISTSEND +%token DENIES +%token DURATION +%token EXTENDER %token FONT -%token GROUPING +%token GLISSANDO +%token GRACE %token HEADER +%token HYPHEN %token IN_T +%token INVALID %token KEY -%token KEYSIGNATURE -%token LYRIC -%token MAEBTELP +%token LYRICS %token MARK %token MEASURES %token MIDI %token MM_T -%token MUSIC -%token MUSICAL_PITCH -%token NOTENAMES +%token PITCH +%token NAME +%token PITCHNAMES %token NOTES -%token OCTAVE -%token OUTPUT %token PAPER %token PARTIAL %token PENALTY -%token PLET %token PROPERTY +%token OVERRIDE SET REVERT %token PT_T %token RELATIVE %token REMOVE +%token REPEAT +%token ADDLYRICS +%token PARTCOMBINE +%token SCM_T %token SCORE %token SCRIPT -%token SHAPE %token SKIP -%token SPANDYNAMIC -%token SYMBOLTABLES -%token TABLE -%token TELP +%token SPANREQUEST +%token STYLESHEET +%token COMMANDSPANREQUEST %token TEMPO +%token OUTPUTPROPERTY %token TIME_T +%token TIMES %token TRANSLATOR %token TRANSPOSE %token TYPE -%token VERSION +%token CONTEXT /* escaped */ -%token E_EXCLAMATION E_SMALLER E_BIGGER E_CHAR +%token E_CHAR E_EXCLAMATION E_SMALLER E_BIGGER +%token CHORD_BASS CHORD_COLON CHORD_MINUS CHORD_CARET -%type dots +%type exclamations questions dots %token DIGIT -%token NOTENAME_PITCH -%token DURATION_IDENTIFIER +%token NOTENAME_PITCH +%token TONICNAME_PITCH +%token CHORDMODIFIER_PITCH +%token DURATION_IDENTIFIER %token IDENTIFIER -%token NOTENAME_TABLE_IDENTIFIER -%token MUSIC_IDENTIFIER -%token POST_REQUEST_IDENTIFIER -%token SCRIPT_IDENTIFIER -%token COMMAND_IDENTIFIER -%token REAL_IDENTIFIER -%token STRING_IDENTIFIER -%token TRANS_IDENTIFIER -%token INT_IDENTIFIER -%token SCORE_IDENTIFIER -%token MIDI_IDENTIFIER -%token PAPER_IDENTIFIER -%token REQUEST_IDENTIFIER -%token REAL -%token DURATION RESTNAME -%token STRING -%token UNSIGNED +%token SCORE_IDENTIFIER +%token MUSIC_OUTPUT_DEF_IDENTIFIER + +%token NUMBER_IDENTIFIER +%token REQUEST_IDENTIFIER +%token MUSIC_IDENTIFIER TRANSLATOR_IDENTIFIER +%token STRING_IDENTIFIER SCM_IDENTIFIER +%token RESTNAME +%token STRING +%token SCM_T +%token UNSIGNED +%token REAL + %type output_def -%type
mudela_header mudela_header_body -%type box -%type open_request_parens close_request_parens -%type open_abbrev_parens -%type open_plet_parens close_plet_parens +%type lilypond_header lilypond_header_body +%type open_request_parens close_request_parens open_request close_request +%type request_with_dir request_that_take_dir verbose_request %type sub_quotes sup_quotes -%type simple_element request_chord command_element -%type abbrev_type -%type int unsigned +%type simple_element request_chord command_element Simple_music Composite_music +%type Alternative_music Repeated_music +%type tremolo_type +%type bare_int bare_unsigned %type script_dir -%type identifier_init simple_identifier_init -%type steno_duration notemode_duration -%type entered_notemode_duration explicit_duration -%type dinterval -%type intastint_list int_list -%type symtables symtables_body - -%type explicit_musical_pitch steno_musical_pitch musical_pitch absolute_musical_pitch -%type steno_notepitch -%type pitch_list -%type midi_block midi_body -%type duration_length - -%type scalar -%type Music relative_music Sequential_music Simultaneous_music + +%type identifier_init + +%type steno_duration optional_notemode_duration +%type entered_notemode_duration explicit_duration + +%type pre_requests post_requests +%type gen_text_def +%type steno_pitch pitch absolute_pitch +%type explicit_pitch steno_tonic_pitch + +%type chord_additions chord_subtractions chord_notes chord_step +%type chord +%type chord_note chord_inversion chord_bass +%type duration_length + +%type embedded_scm scalar +%type Music Sequential_music Simultaneous_music Music_sequence +%type relative_music re_rhythmed_music part_combined_music %type property_def translator_change -%type Music_list -%type paper_block paper_def_body -%type dim real -%type real_mult_expression real_primary -%type unit -%type abbrev_command_req -%type post_request structured_post_request -%type plet_fraction -%type command_req verbose_command_req -%type script_req dynamic_req -%type string -%type string_primary +%type Music_list +%type music_output_def_body +%type shorthand_command_req +%type post_request +%type command_req verbose_command_req +%type extender_req +%type hyphen_req +%type string bare_number number_expression %type score_block score_body -%type shape_array -%type