1 A					[a-zA-Z\200-\377]
2 AA					{A}|_
3 N					[0-9]
4 AN					{AA}|{N}
5 
6 
7 ANY_CHAR			(.|\n)
8 PUNCT				[?!:'`]
9 ACCENT				\\[`'"^]
10 NATIONAL			[\001-\006\021-\027\031\036]
11 TEX					{AA}|-|{PUNCT}|{ACCENT}|{NATIONAL}
12 WORD				{A}{AN}*
13 DASHED_WORD			{A}({AN}|-)*
14 DASHED_KEY_WORD		\\{DASHED_WORD}
15 
16 
17 
18 ALPHAWORD			{A}+
19 DIGIT				{N}
20 UNSIGNED			{N}+
21 E_UNSIGNED			\\{N}+
22 FRACTION			{N}+\/{N}+
23 INT					-?{UNSIGNED}
24 REAL				({INT}\.{N}*)|(-?\.{N}+)
25 KEYWORD				\\{WORD}
26 NEWLINE				[^.] ; windows and linux/unix
27 WHITE				[ 	] ;space and tab!
28 HORIZONTALWHITE		[ 	]
29 BLACK				[^ \n\t\f\r] ;TODO: needs fix
30 RESTNAME			[rs]
31 NOTECOMMAND			\\{A}+
32 MARKUPCOMMAND		\\({A}|[-_])+
33 LYRICS				({AA}|{TEX})[^0-9 \t\n\r\f]*
34 ESCAPED				[nt\\'"]
35 EXTENDER			__
36 HYPHEN				--
37 BOM_UTF8			\357\273\277
38 
39 %%
40 
41 {BOM_UTF8}/.* 		(yycontinue)
42 ;original bom_utf8/.*
43 ;  if (this->lexloc_->line_number () != 1 || this->lexloc_->column_number () != 0)
44 ;    {
45 ;      LexerError (_ ("stray UTF-8 BOM encountered").c_str ());
46 ;      exit (1);
47 ;    }
48 ;  if (be_verbose_global)
49 ;     message (_ ("Skipping UTF-8 BOM"));
50 
51 
52 
53 
54 \"		(lyimport::start_quote) (lyimport::multilexer)  ;cannot use yycontinue as that calls this lexer
55 
56 
57 \\paper{WHITE}*\{         (lyimport::start_block) (lyimport::multilexer)
58 \\layout{WHITE}*\{         (lyimport::start_block) (lyimport::multilexer)
59 \\header{WHITE}*\{         (lyimport::start_block) (lyimport::multilexer)
60 \\midi{WHITE}*\{         (lyimport::start_block) (lyimport::multilexer)
61 \\markup{WHITE}*\{         (lyimport::start_block)  (lyimport::mtoken 'MARKUP ((record-accessor lexical-token 'value)(lyimport::multilexer)))
62 
63 \\version{WHITE}*.*{NEWLINE} (lyimport::mtoken 'VERSION	yytext) ; in lilypond it is a state switch yy_push_state (version)
64 %.*{NEWLINE}				(yycontinue)
65 \\sourcefilename{WHITE}*	(lyimport::mtoken 'ERROR	yytext) ; yy_push_state (sourcefilename)
66 \\sourcefileline{WHITE}*	(lyimport::mtoken 'ERROR	yytext) ; yy_push_state (sourcefileline)
67 \\maininput         		(lyimport::mtoken 'ERROR	yytext) ; if (!is_main_input_) (block: start_main_input (); is_main_input_ = true; ) ELSE	error (_ ("\\maininput not allowed outside init files"));
68 \\include           	  (lyimport::start_incl) (display "include state started")(lyimport::multilexer)
69 
70 {RESTNAME}					(lyimport::mtoken 'RESTNAME yytext)
71 #                                               (begin
72                                                    (lyimport::mtoken 'SCM_TOKEN (read (make-soft-port
73                                                              (vector #f #f #f  (lambda () (lexer-getc)) #f) "r"))))
74 
75 
76 \\lyricmode{WHITE}*\{         (lyimport::start_block) (lyimport::multilexer)
77 \\chordmode{WHITE}*\{         (lyimport::start_block)  (lyimport::multilexer)
78 
79 
80 R							(lyimport::mtoken 'MULTI_MEASURE_REST yytext)
81 <<							(lyimport::mtoken 'DOUBLE_ANGLE_OPEN yytext)
82 >>							(lyimport::mtoken 'DOUBLE_ANGLE_CLOSE yytext)
83 <							(lyimport::mtoken 'ANGLE_OPEN yytext)
84 >							(lyimport::mtoken 'ANGLE_CLOSE yytext)
85 {ALPHAWORD}					(lyimport::scan_bare_word yytext)
86 {NOTECOMMAND}				(lyimport::scan_escaped_word (string-trim yytext #\\))
87 {FRACTION}					(lyimport::scan_fraction yytext)	;		yylval.scm =  scan_fraction (YYText ()); return FRACTION;
88 {DIGIT}						(lyimport::mtoken 'DIGIT yytext)
89 {UNSIGNED}					(lyimport::mtoken 'UNSIGNED yytext)
90 {E_UNSIGNED}				(lyimport::mtoken 'E_UNSIGNED yytext)
91 
92 \{							(lyimport::mtoken '{ yytext)
93 \}							(lyimport::mtoken '} yytext)
94 
95 \*							(lyimport::mtoken 'STAR yytext)
96 :							(lyimport::mtoken ': yytext)
97 =							(lyimport::mtoken 'EQUAL yytext)
98 \.							(lyimport::mtoken 'DOT yytext)
99 !							(lyimport::mtoken 'EXCLAMATIONMARK yytext)
100 \?							(lyimport::mtoken 'QUESTIONMARK yytext)
101 \|							(lyimport::mtoken 'PIPE yytext)
102 /							(lyimport::mtoken 'SLASH yytext)
103 \^							(lyimport::mtoken 'CARET yytext)
104 _							(lyimport::mtoken 'UNDERSCORE yytext)
105 -							(lyimport::mtoken 'HYPHEN yytext)
106 ~							(lyimport::mtoken 'TILDE yytext) ; This may be the wrong place. But the lexer did not detect E_TILDE with the block \\. below
107 \[							(lyimport::mtoken 'BRACKET_OPEN yytext) ; This is a custom lexer rule. In Lilypond these are used directly as strings in the parser.
108 \]							(lyimport::mtoken 'BRACKET_CLOSE yytext) ; This is a custom lexer rule. In Lilypond these are used directly as strings in the parser.
109 
110 \(         (lyimport::mtoken 'OPEN yytext); for slurs
111 \)         (lyimport::mtoken 'CLOSE yytext); for slurs
112 
113 
114 \\.							(case (string-ref yytext 0) ; not sure for what this is. maybe scheme escaped parts in lilypond?
115 								((#\>) (lyimport::mtoken 'E_ANGLE_CLOSE yytext))
116 								((#\<) (lyimport::mtoken 'E_ANGLE_OPEN yytext))
117 								((#\!) (lyimport::mtoken 'E_EXCLAMATION yytext))
118 								((#\() (lyimport::mtoken 'E_OPEN yytext))
119 								((#\)) (lyimport::mtoken 'E_CLOSE yytext))
120 								((#\[) (lyimport::mtoken 'E_BRACKET_OPEN yytext))
121 								((#\+) (lyimport::mtoken 'E_PLUS yytext))
122 								((#\]) (lyimport::mtoken 'E_BRACKET_CLOSE yytext))
123 								((#\~) (lyimport::mtoken 'E_TILDE yytext))
124 								((#\\) (lyimport::mtoken 'E_BACKSLASH yytext))
125 								(else  (lyimport::mtoken 'E_CHAR yytext)))
126 
127 
128 
129 ,							(lyimport::mtoken 'SUB_QUOTE yytext)
130 '							(lyimport::mtoken 'SUP_QUOTE yytext)
131 ;\+							(lyimport::mtoken 'PLUS yytext)
132 \+							(lyimport::mtoken 'STRING yytext)
133 
134 ({WHITE}|{NEWLINE})			(yycontinue);(lyimport::mtoken 'WHITESPACE yytext)
135 .							(lyimport::mtoken 'ANYTHING yytext) ; in lilypond there is no token name
136 ;\"							(lyimport::mtoken 'DBLQUOTE yytext) ;; This is a custom Denemo token
137 
138 <<ERROR>>					(lyimport::mtoken 'ERROR	yytext)
139 <<EOF>>						(make-lexical-token '*eoi* #f #f)
140