/* G-Cows - scripting language for creation of web sites Copyright (C) 2002, 2003, 2004, 2005, 2006 Andrea Sozzi This file is part of G-Cows. G-Cows 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 2, or (at your option) any later version. G-Cows 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; see the file COPYING. If not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ %{ #include "common.H" #include "error.H" #include "cows-mkgen_options.H" BEGIN_C_DECLS int yytmplwrap () { return 1; } END_C_DECLS %} %x branch %x main SP [ \t\n]* %% %{ extern string yytmpllval; string source, destination, cows_options, common_cows_options, branch_options; %} <*> { "#".+ } { ^"brief:" return Mkgen_opt::brief; ^"fatal-warnings:" return Mkgen_opt::fatal_warnings; ^"ignore_errors:" return Mkgen_opt::ignore_errors; ^"quiet:" return Mkgen_opt::quiet; ^"silent:" return Mkgen_opt::silent; ^"verbose:" return Mkgen_opt::verbose; ^"fast:" return Mkgen_opt::fast; ^"prefix:".+ { yytmpllval = string (strchr (yytext, ':') + 1); return Mkgen_opt::prefix; } ^"source-extension:".+ { yytmpllval = string (strchr (yytext, ':') + 1); return Mkgen_opt::source; } ^"target-extension:".+ { yytmpllval = string (strchr (yytext, ':') + 1); return Mkgen_opt::target; } ^"cows-option:".+ { yytmpllval = string (strchr (yytext, ':') + 1); return Mkgen_opt::option; } ^"translations:".+ { yytmpllval = string (strchr (yytext, ':') + 1); return Mkgen_opt::lang; } "*branch*"[^*\n \t]+"*"[^*\n \t]+ { yytmpllval = string (strchr (yytext + 1, '*') + 1) + "*"; branch_options = "--parents "; BEGIN (branch); } "*main" { yytmpllval = ""; branch_options = ""; BEGIN (main); } }
{ ^"cows-option:".+ { branch_options += (" " + string (strchr (yytext, ':') + 1) + " "); } ^"end-main" { BEGIN (INITIAL); yytmpllval += branch_options; return Mkgen_opt::main_site; } } { ^"cows-option:".+ { branch_options += (" " + string (strchr (yytext, ':') + 1) + " "); } ^"end-branch" { BEGIN (INITIAL); yytmpllval += branch_options; return Mkgen_opt::new_branch; } } <*> { [\n\t] /* Save lives. Eat whitespaces. Don't eat meat! */ . { /* This __MUST__ be the last rule */ Msg::inst()->fatal ("Wrong template file"); } } <> yyterminate (); %%