diff options
Diffstat (limited to 'Build/source/texk/gregorio/gregorio-4.0.0-beta2/src/vowel/vowel-rules.l')
-rw-r--r-- | Build/source/texk/gregorio/gregorio-4.0.0-beta2/src/vowel/vowel-rules.l | 91 |
1 files changed, 91 insertions, 0 deletions
diff --git a/Build/source/texk/gregorio/gregorio-4.0.0-beta2/src/vowel/vowel-rules.l b/Build/source/texk/gregorio/gregorio-4.0.0-beta2/src/vowel/vowel-rules.l new file mode 100644 index 00000000000..2b0a318a951 --- /dev/null +++ b/Build/source/texk/gregorio/gregorio-4.0.0-beta2/src/vowel/vowel-rules.l @@ -0,0 +1,91 @@ +%{ +/* + * Copyright (C) 2015 The Gregorio Project (see CONTRIBUTORS.md) + * + * This file is part of Gregorio. + * + * This program is free software: you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the Free + * Software Foundation, either version 3 of the License, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + * + * You should have received a copy of the GNU General Public License along with + * this program. If not, see <http://www.gnu.org/licenses/>. + */ + +#include "config.h" +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include "struct.h" +#include "messages.h" + +#include "vowel.h" + +#include "vowel-rules.h" +#include "vowel-rules-y.h" + +#define YY_NO_INPUT + +static __inline void save_lval(void) +{ + gregorio_vowel_rulefile_lval = + malloc((gregorio_vowel_rulefile_leng + 1) * sizeof(char)); + strncpy(gregorio_vowel_rulefile_lval, gregorio_vowel_rulefile_text, + gregorio_vowel_rulefile_leng); + gregorio_vowel_rulefile_lval[gregorio_vowel_rulefile_leng] = '\0'; +} + +static __inline void invalid(void) +{ + gregorio_messagef("gregorio_vowel_rulefile_lex", VERBOSITY_WARNING, 0, + _("invalid character in vowel file: %c"), + *gregorio_vowel_rulefile_text); +} +%} + +%x chars +%x lang +%x langname + +%option stack +%option pointer +%option nounput +%option noyy_push_state +%option noyy_pop_state +%option noyy_top_state +%option align +%option noread +%option nomain +%option noalways-interactive +%option nonever-interactive +%option prefix="gregorio_vowel_rulefile_" +%option noyywrap +%option 8bit + +%% + +<INITIAL>language { BEGIN(lang); return LANGUAGE; } +<INITIAL>vowel { BEGIN(chars); return VOWEL; } +<INITIAL>prefix { BEGIN(chars); return PREFIX; } +<INITIAL>suffix { BEGIN(chars); return SUFFIX; } +<INITIAL>secondary { BEGIN(chars); return SECONDARY; } +<INITIAL>alias { BEGIN(lang); return ALIAS; } +<*>; { BEGIN(INITIAL); return SEMICOLON; } +<lang>to { return TO; } +<lang>"[" { BEGIN(langname); } +<langname>[^\]]+ { save_lval(); return NAME; } +<langname>"]" { BEGIN(lang); } +<chars>[^;,# \t\n\r\v\f]+ { save_lval(); return CHARACTERS; } +<*>#[^\n\r]* { } +<INITIAL>\xEF\xBB\xBF { } +<*>[\ \t\n\r\v\f] { } +<*>. { invalid(); return INVALID; } + +%% + |