I have the following python program:
from pyparsing import *
#grammar START
string_list_item = dblQuotedString | Word(printables.replace(')', ''))
cmake_list_content = OneOrMore(string_list_item)
variable_name = Word(alphas+"_", alphanums+"_")
set_keyword = CaselessLiteral("set")
set_normal_variable_stmt = set_keyword + "(" \
+ variable_name \
+ cmake_list_content + ")"
#grammar END
cmake_source = "set(TabsPls_Sources Main.cpp)"
string_list_item.setDebug()
set_normal_variable_stmt.parseString(cmake_source)
This gives the following output for 'Main.cpp':
Match {string enclosed in double quotes | W:(0123...)} at loc 19(1,20)
Matched {string enclosed in double quotes | W:(0123...)} -> ['Main.cpp']
But when I remove the dblQuotedString from the first line:
Match W:(0123...) at loc 20(1,21)
Matched W:(0123...) -> ['Main.cpp']
Why does that happen? There aren't any double quoted strings in the input so why does the match location change?
Closing this question myself because this was due to a bug #244, which has now been fixed!