summaryrefslogtreecommitdiffabout
path: root/lib/sitecing_parser.ll
authorMichael Krelin <hacker@klever.net>2005-04-25 16:36:32 (UTC)
committer Michael Krelin <hacker@klever.net>2005-04-25 16:36:32 (UTC)
commit981b219f5297ad2ccc1fc1d0e24e41ec009c35a3 (patch) (side-by-side diff)
tree9fa81d7fe70883ad26d946c902ba06edcebd4516 /lib/sitecing_parser.ll
parent54e344b7e3623e807b893b7febad3adfc6c1648f (diff)
downloadsitecing-981b219f5297ad2ccc1fc1d0e24e41ec009c35a3.zip
sitecing-981b219f5297ad2ccc1fc1d0e24e41ec009c35a3.tar.gz
sitecing-981b219f5297ad2ccc1fc1d0e24e41ec009c35a3.tar.bz2
moved a few utility functions to konforka and bumped konforka version requirement accordingly
Diffstat (limited to 'lib/sitecing_parser.ll') (more/less context) (ignore whitespace changes)
-rw-r--r--lib/sitecing_parser.ll13
1 files changed, 7 insertions, 6 deletions
diff --git a/lib/sitecing_parser.ll b/lib/sitecing_parser.ll
index 4fd6709..8dd8d5f 100644
--- a/lib/sitecing_parser.ll
+++ b/lib/sitecing_parser.ll
@@ -1,33 +1,34 @@
%{
/*
* XXX: I have a strong feeling that this parser should be completely rewritten.
*/
#include <iostream>
#include <fstream>
#include <cassert>
#include <stdexcept>
using namespace std;
+#include <konforka/util.h>
#include "sitecing/sitecing_util.h"
#include "sitecing/sitecing_exception.h"
using namespace sitecing;
#define sitecing_parser_flexlexer_once
#include "sitecing/sitecing_parser.h"
#include "sitecing/sitecing_enflesher.h"
#undef yyFlexLexer
#define yyFlexLexer sitecing_parserFlexLexer
%}
%x SLASHSTAR_COMMENT SLASHSLASH_COMMENT STRING
%x CODELINE CLASSLINE DECLLINE IMPLLINE DECLBLOCK IMPLBLOCK VARLINE VARINIT
%x IMPORTLINE IMPORTCOMPONENT
%x IMPORTTYPELINE IMPORTTYPECOMPONENT
%x DERIVELINE DERIVECOMPONENT
%x CONSTRUCTOR DESTRUCTOR CODEMETHODLINE CODEMETHODARGS
%x CODEMETHODBLOCK INLINE METHODLINE METHODARGS METHODBLOCK CODEBLOCK OUTPUTBLOCK
%x PRAGMALINE
%option 8bit c++ verbose noyywrap yyclass="sitecing_parser" prefix="sitecing_parser" stack yylineno
WHITESPACE [ \t]
ID [A-Za-z_][A-Za-z0-9_]*
NOIDCHAR [^A-Za-z0-9_]
%%
@@ -276,118 +277,118 @@ NOIDCHAR [^A-Za-z0-9_]
modus_operandi& m = M();
if(!m._name.empty())
throw preprocessor_error(CODEPOINT,"syntax error",lineno());
m._name = yytext;
}
\= {
M().output.clear();
BEGIN(IMPORTCOMPONENT);
}
}
<IMPORTCOMPONENT>{
{WHITESPACE}+ { }
\n {
modus_operandi& m = M();
string::size_type t = m.output.find_first_not_of(" \t");
if(t!=string::npos)
m.output.erase(0,t);
t = m.output.find_last_not_of(" \t;");
if(t!=string::npos)
m.output.erase(t+1);
if(m.output[0]=='"' && m.output[m.output.length()-1]=='"') {
m.output.erase(0,1);
m.output.erase(m.output.length()-1);
}
- string c = combine_path(component_basename,m.output);
- member_variables.push_back(member_variable(m._type,m._name,normalize_path(c,strip_leading_slash),true));
+ string c = konforka::combine_path(component_basename,m.output);
+ member_variables.push_back(member_variable(m._type,m._name,konforka::normalize_path(c,konforka::strip_leading_slash),true));
modi.pop_front();
BEGIN(INITIAL);
}
}
<IMPORTTYPELINE>{
{WHITESPACE}+ { }
{ID} {
modus_operandi& m = M();
if(!m._name.empty())
throw preprocessor_error(CODEPOINT,"syntax error",lineno());
m._name = yytext;
}
\= {
M().output.clear();
BEGIN(IMPORTTYPECOMPONENT);
}
}
<IMPORTTYPECOMPONENT>{
{WHITESPACE}+ { }
\n {
modus_operandi& m = M();
string::size_type t = m.output.find_first_not_of(" \t");
if(t!=string::npos)
m.output.erase(0,t);
t = m.output.find_last_not_of(" \t;");
if(t!=string::npos)
m.output.erase(t+1);
if(m.output[0]=='"' && m.output[m.output.length()-1]=='"') {
m.output.erase(0,1);
m.output.erase(m.output.length()-1);
}
- string c = combine_path(component_basename,m.output);
- member_variables.push_back(member_variable(m._type,m._name,normalize_path(c,strip_leading_slash),true,true));
+ string c = konforka::combine_path(component_basename,m.output);
+ member_variables.push_back(member_variable(m._type,m._name,konforka::normalize_path(c,konforka::strip_leading_slash),true,true));
modi.pop_front();
BEGIN(INITIAL);
}
}
<DERIVELINE>{
{WHITESPACE}+ { }
{ID} {
modus_operandi& m = M();
if(!m._name.empty())
throw preprocessor_error(CODEPOINT,"syntax_error",lineno());
m._name = yytext;
}
\= {
M().output.clear();
BEGIN(DERIVECOMPONENT);
}
}
<DERIVECOMPONENT>{
{WHITESPACE}+ { }
\n {
modus_operandi& m = M();
string::size_type t = m.output.find_first_not_of(" \t");
if(t!=string::npos)
m.output.erase(0,t);
t = m.output.find_last_not_of(" \t;");
if(t!=string::npos)
m.output.erase(t+1);
if(m.output[0]=='"' && m.output[m.output.length()-1]=='"') {
m.output.erase(0,1);
m.output.erase(m.output.length()-1);
}
- string c = combine_path(component_basename,m.output);
- ancestor_classes.push_back(ancestor_class(m._name,normalize_path(c,strip_leading_slash)));
+ string c = konforka::combine_path(component_basename,m.output);
+ ancestor_classes.push_back(ancestor_class(m._name,konforka::normalize_path(c,konforka::strip_leading_slash)));
modi.pop_front();
BEGIN(INITIAL);
}
}
<VARLINE>{
{WHITESPACE}+ {
modus_operandi& m = M();
if(!m.output.empty()) {
if(!m._lastid.empty()) {
if(!m._type.empty()) m._type += ' ';
m._type += m._lastid;
}
m._lastid = m.output;
m.output.clear();
}
}
\* {
modus_operandi& m = M();
ECHO;
if(!m._lastid.empty()) {
if(!m._type.empty()) m._type += ' ';
m._type += m._lastid;
}