From 315733970daf1abe2ec088a61332880e24b415cc Mon Sep 17 00:00:00 2001 From: albert-github Date: Sun, 7 Apr 2019 18:30:34 +0200 Subject: Class definition with collections Class definitions can have collections and these can have strings e.g.: class Url(namedtuple('Url', url_attrs)): and this results in: warning: Detected potential recursive class relation between class conda::_vendor::urllib3::util::url::Url and base class Url! Strings are now possible and seen as strings. See also (including example with namedtuble): https://docs.python.org/3/library/collections.html --- src/pyscanner.l | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/src/pyscanner.l b/src/pyscanner.l index 655b6e2..b476eec 100644 --- a/src/pyscanner.l +++ b/src/pyscanner.l @@ -537,6 +537,8 @@ STARTDOCSYMS "##" %x SingleQuoteString %x DoubleQuoteString %x TripleString +%x SingleQuoteStringIgnore +%x DoubleQuoteStringIgnore /* import */ %x FromMod @@ -1282,8 +1284,28 @@ STARTDOCSYMS "##" ); //Has base class-do stuff } + "'" { // start of a single quoted string + g_stringContext=YY_START; + BEGIN( SingleQuoteStringIgnore ); + } + "\"" { // start of a double quoted string + g_stringContext=YY_START; + BEGIN( DoubleQuoteStringIgnore ); + } } +{ + "'" { // end of a single quoted string + BEGIN(g_stringContext); + } + . { } +} +{ + "\"" { // end of a double quoted string + BEGIN(g_stringContext); + } + . { } +} { "\n"|({BB}"\n") { @@ -1702,6 +1724,10 @@ STARTDOCSYMS "##" lineCount(); } +<*>"'" { + fprintf(stderr,"Quote: %d\n",YY_START); + } + <*>. { //printf("[pyscanner] '%s' [ state %d ] [line %d] no match\n", // yytext, YY_START, yyLineNr); -- cgit v0.12