summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorDimitri van Heesch <dimitri@stack.nl>2016-08-28 11:22:57 (GMT)
committerGitHub <noreply@github.com>2016-08-28 11:22:57 (GMT)
commit8b1e673c427be33887373e766eff02c9fe57b39f (patch)
treece87f830e292816445c91d8d7fcf78c0cddfc2f3 /src
parent725c7e35be17898c7cc7bfc51b8e2dfbca82bbb5 (diff)
parent46ba7769c4a0600c47f3de6871815398bab7ca91 (diff)
downloadDoxygen-8b1e673c427be33887373e766eff02c9fe57b39f.zip
Doxygen-8b1e673c427be33887373e766eff02c9fe57b39f.tar.gz
Doxygen-8b1e673c427be33887373e766eff02c9fe57b39f.tar.bz2
Merge pull request #506 from albert-github/feature/bug_python_init
Initialization of python variables and type determination
Diffstat (limited to 'src')
-rw-r--r--src/pyscanner.l40
1 files changed, 26 insertions, 14 deletions
diff --git a/src/pyscanner.l b/src/pyscanner.l
index 35d305d..3bebe0e 100644
--- a/src/pyscanner.l
+++ b/src/pyscanner.l
@@ -1205,51 +1205,49 @@ STARTDOCSYMS "##"
current->initializer += " ";
}
{B} { // spaces
+ current->initializer += yytext;
}
{INTNUMBER} { // integer value
- current->type = "int";
+ if (current-> type.isEmpty()) current->type = "int";
current->initializer += yytext;
- BEGIN(VariableEnd);
}
{FLOATNUMBER} { // floating point value
- current->type = "float";
+ if (current->type.isEmpty()) current->type = "float";
current->initializer += yytext;
- BEGIN(VariableEnd);
}
{BOOL} { // boolean value
- current->type = "bool";
+ if (current->type.isEmpty()) current->type = "bool";
current->initializer += yytext;
- BEGIN(VariableEnd);
}
{STRINGPREFIX}?"'" { // string
- current->type = "string";
+ if (current->type.isEmpty()) current->type = "string";
current->initializer += yytext;
g_copyString=&current->initializer;
- g_stringContext=VariableEnd;
+ g_stringContext=VariableDec;
BEGIN( SingleQuoteString );
}
{STRINGPREFIX}?"\"" { // string
- current->type = "string";
+ if (current->type.isEmpty()) current->type = "string";
current->initializer += yytext;
g_copyString=&current->initializer;
- g_stringContext=VariableEnd;
+ g_stringContext=VariableDec;
BEGIN( DoubleQuoteString );
}
{TRIDOUBLEQUOTE} { // start of a comment block
- current->type = "string";
+ if (current->type.isEmpty()) current->type = "string";
current->initializer += yytext;
g_doubleQuote=TRUE;
g_copyString=&current->initializer;
- g_stringContext=VariableEnd;
+ g_stringContext=VariableDec;
BEGIN(TripleString);
}
{TRISINGLEQUOTE} { // start of a comment block
- current->type = "string";
+ if (current->type.isEmpty()) current->type = "string";
current->initializer += yytext;
g_doubleQuote=FALSE;
g_copyString=&current->initializer;
- g_stringContext=VariableEnd;
+ g_stringContext=VariableDec;
BEGIN(TripleString);
}
"(" { // tuple, only when direct after =
@@ -1283,6 +1281,20 @@ STARTDOCSYMS "##"
BEGIN( VariableEnd );
}
{IDENTIFIER} {
+ // do something based on the type of the IDENTIFIER
+ if (current->type.isEmpty())
+ {
+ QListIterator<Entry> eli(*(current_root->children()));
+ Entry *child;
+ for (eli.toFirst();(child=eli.current());++eli)
+ {
+ if (child->name == QCString(yytext))
+ {
+ current->type = child->type;
+ break;
+ }
+ }
+ }
g_start_init = FALSE;
current->initializer+=yytext;
}