Recent Changes

Sunday, August 13

  1. msg schemaSQL.parseFile(f) fails if parseAll=True attemted message posted schemaSQL.parseFile(f) fails if parseAll=True attemted According to the CHANGES file, it looks like that named arg was added to parseFile in version 1.5.1…
    schemaSQL.parseFile(f) fails if parseAll=True attemted
    According to the CHANGES file, it looks like that named arg was added to parseFile in version 1.5.1, back in '08. Are you on an old version of pyparsing?
    4:59 pm
  2. msg schemaSQL.parseFile(f) fails if parseAll=True attemted message posted schemaSQL.parseFile(f) fails if parseAll=True attemted result = schemaSQL.parseFile(f,parseAll=True) fails with TypeError: parseFile() got a…
    schemaSQL.parseFile(f) fails if parseAll=True attemted
        result = schemaSQL.parseFile(f,parseAll=True)
    fails with TypeError: parseFile() got an unexpected keyword argument 'parseAll',
    while doc says: def parseFile( self, file_or_filename, parseAll=False ):

    Any pointers?
    4:19 pm

Thursday, August 3

  1. msg Group result question message posted Group result question Thanks, result[2].asList()] worked perfectly. The result indices feels better with the plain…
    Group result question
    Thanks,
    result[2].asList()] worked perfectly.
    The result indices feels better with the plain list:
    ....
    ['file_inst_parent_idx', 'file_instance', 1, ['parent_id']]
    ['file_inst_src_data_file_idx', 'file_instance', 2, ['source_data_id', 'file_id']]
    ['file_inst_strm_file_idx', 'file_instance', 1, ['stream_file_id']]
    ...
    6:12 pm
  2. msg Group result question message posted Group result question There is no array ("list" actually) and there is no dict. What you are seeing is the repr…
    Group result question
    There is no array ("list" actually) and there is no dict. What you are seeing is the repr representation of pyparsing's parse output object, ParseResults. Since ParseResults objects can be accessed in both list and dict forms, the repr output shows the list elements as a list and any named elements as a dict. You can iterate over the ParseResults, index into them, invoke len() on them, just like any list, or invoke keys(), items(), values(), etc. just like a dict. See more info about ParseResults capabilities at https://pythonhosted.org/pyparsing/pyparsing.ParseResults-class.html . If you *must* have a list or dict, this class also supports asList() and asDict() methods, but you may be able to do without them. Please give it a shot and just use this as if it were a list, for instance, try printing "','.join(result[2])".
    12:45 pm
  3. msg Group result question message posted Group result question I'm parsing CREATE INDEX sql statements as : create index dft_inst_strm_dft_snpsht_el_idx on defe…
    Group result question
    I'm parsing CREATE INDEX sql statements as :
    create index dft_inst_strm_dft_snpsht_el_idx on defect_instance (stream_defect_id, snapshot_element_id);
    I'm parsing the "on defect_instance (stream_defect_id, snapshot_element_id)" part with the grammar:

    ON = Keyword("on", caseless=True).addParseAction(upcaseTokens)
    LPAREN= Suppress("(")
    RPAREN= Suppress(")")

    idxspec = ON + ident + LPAREN + Group(delimitedList(ident)) + RPAREN
    ....
    result = idxspec.parseString(stmt[3][0])
    indices.append([stmt[2] , result[1] , len(result[2]) , result[2]])
    ....
    The returned result[2] (for the Group(delimitedList(ident))) prints as (['stream_defect_id', 'snapshot_element_id'], {}) as in the appended array:

    ['dft_inst_strm_dft_snpsht_el_idx', 'defect_instance', 2, (['stream_defect_id', 'snapshot_element_id'], {})]

    I expected an ['stream_defect_id', 'snapshot_element_id'] for result[2], but looks like a tuple with the extra empty dictionary added.
    Is there an explanation, and a way to extract the "naked" array without the empty dict?
    10:43 am
  4. 10:39 am

Monday, July 17

  1. 11:41 am

Wednesday, July 5

  1. msg Prevent an element from matching dependent on context message posted Prevent an element from matching dependent on context A Cythonic pyparsing has been worked on in the past (I say this not to discourage because of prior …
    Prevent an element from matching dependent on context
    A Cythonic pyparsing has been worked on in the past (I say this not to discourage because of prior activity but to encourage as to feasibility), I'll try to track it down from prior efforts.

    I'll have to think about the contextmanager bit - I'll need to include it in a Py2.6-compatible form while I'm still supporting back to that version in a single code base, but I'm especially fond of the contextmanager concept, and wrapping an expression in a larger expression is consistent with pyparsing's philosophy. Thanks for the suggestions!
    6:20 am

Tuesday, July 4

  1. msg Prevent an element from matching dependent on context message posted Prevent an element from matching dependent on context Yeah, that's definitely helpful! Like you said, it does require the string to get parsed twice, tho…
    Prevent an element from matching dependent on context
    Yeah, that's definitely helpful! Like you said, it does require the string to get parsed twice, though, which is fairly inefficient. If you're curious, I ended up going with this: https://github.com/evhub/coconut/blob/develop/coconut/compiler/util.py#L246

    Being able to wrap a token in a context manager was all I really needed. Maybe "Wrap" is something you might want to consider including?

    On an unrelated note, I'm thinking of rewriting PyParsing in Cython to try to squeeze out some extra performance benefits for Coconut. I'll probably host it on GitHub and put it up as cpyparsing or some such thing on PyPI, if you don't mind.
    12:25 pm

Wednesday, June 28

  1. msg Prevent an element from matching dependent on context message posted Prevent an element from matching dependent on context Oops, I had also added a Group in expr0: expr0 = atom | Group(no1open + expr_no_op1 + no1close)
    Prevent an element from matching dependent on context
    Oops, I had also added a Group in expr0: expr0 = atom | Group(no1open + expr_no_op1 + no1close)
    1:30 am

More