Skip to content

Commit

Permalink
Class definition with collections
Browse files Browse the repository at this point in the history
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
  • Loading branch information
albert-github committed Apr 7, 2019
1 parent 16d025c commit 3157339
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions src/pyscanner.l
Original file line number Diff line number Diff line change
Expand Up @@ -537,6 +537,8 @@ STARTDOCSYMS "##"
%x SingleQuoteString
%x DoubleQuoteString
%x TripleString
%x SingleQuoteStringIgnore
%x DoubleQuoteStringIgnore
/* import */
%x FromMod
Expand Down Expand Up @@ -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 );
}
}

<SingleQuoteStringIgnore>{
"'" { // end of a single quoted string
BEGIN(g_stringContext);
}
. { }
}
<DoubleQuoteStringIgnore>{
"\"" { // end of a double quoted string
BEGIN(g_stringContext);
}
. { }
}

<ClassCaptureIndent>{
"\n"|({BB}"\n") {
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit 3157339

Please sign in to comment.