Having trouble with IMPORT MODULENAME in Python grammar (GOLDParser) Anyone have a clue Files attached

Simple DBTEST.py module will not pass grammar test. “sqlite3” wiill not pass basically an {AlphaNumeric}+ specification. I’ve tried
{Letter}{AlphaNumeric}* and others but nothing works. Grammar “compiles” fine with no errors. I can’t see anything wrong with “‘import’ NAME” rule.

Thanks, RR (For Python fans, this is your chance to get pretty clean 3.4.2 grammar module. It is straight from the Tutorial and cleanly converted.)

Python_Grammar_3.4.2.txt (11 KB)

DBTEST.py (721 Bytes)

Right, because I believe the problem isn’t the “import” statement, it’s the comment before it. Do you understand that ! is the comment character in that parser? All lines starting with ! are ignored.

···

On Feb 21, 2015, at 1:39 PM, RLRandallx <robinlrandall@gmail.com> wrote:

Simple DBTEST.py module will not pass grammar test. "sqlite3" wiill not pass basically an {AlphaNumeric}+ specification. I've tried
{Letter}{AlphaNumeric}* and others but nothing works. Grammar "compiles" fine with no errors. I can't see anything wrong with "'import' NAME" rule.


Tim Roberts, timr@probo.com
Providenza & Boekelheide, Inc.

Hi Tim,

I do understand the use of “!” but I thought I could intersperse lines anywhere in

the grammar.

THE SOURCE HAS::

“”"

A minimal SQLite shell for experiments

import sqlite3

“”"

AND THE GRAMMAR HAS:

:

<raise_stmt> ::= ‘raise’ | ‘raise’ | ‘raise’ ‘from’

<import_stmt> ::= <import_name> | <import_from> | ‘import’ <import_as_name>

<import_name> ::= ‘import’ <dotted_as_names> | ‘import’ <name_list>

! note below ::= the (‘.’ | ‘…’) is necessary because ‘…’ is tokenized as ELLIPSIS

<import_from> ::= ‘from’ ‘.’ | ‘…’ <dotted_name> | ‘.’ | ‘…’ ‘import’ ‘*’ | ‘(’ <name_list> ‘)’ | <name_list> | <dotted_as_names>

<import_as_name> ::= NAME ‘as’ NAME

NAME

<dotted_as_name> ::= <dotted_name> ‘as’ NAME

<dotted_as_names> ::= <dotted_as_name> | <dotted_as_name> ‘,’ <dotted_as_names>

<dotted_name> ::= NAME ‘.’ <dotted_name>

NAME ‘.’ NAME

<name_list> ::= NAME ‘,’ NAME | <name_list> ‘,’ NAME

···

:

“”"

Are you saying the “!note below” line is causing a problem? On my screen it shows up green but the line below shows blue

When I step through the source, it stops right after “import”.

I will remove the comment and see if it works. That would imply

that there is a bug somewhere in ignoring comments.

Thanks,

Robin

On Sun, Feb 22, 2015 at 10:14 PM, Tim Roberts timr@probo.com wrote:

On Feb 21, 2015, at 1:39 PM, RLRandallx robinlrandall@gmail.com wrote:

Simple DBTEST.py module will not pass grammar test. “sqlite3” wiill not pass basically an {AlphaNumeric}+ specification. I’ve tried

{Letter}{AlphaNumeric}* and others but nothing works. Grammar “compiles” fine with no errors. I can’t see anything wrong with “‘import’ NAME” rule.

Right, because I believe the problem isn’t the “import” statement, it’s the comment before it. Do you understand that ! is the comment character in that parser? All lines starting with ! are ignored.

Tim Roberts, timr@probo.com

Providenza & Boekelheide, Inc.

You received this message because you are subscribed to a topic in the Google Groups “wxPython-users” group.

To unsubscribe from this topic, visit https://groups.google.com/d/topic/wxpython-users/27K9TI3_cS4/unsubscribe.

To unsubscribe from this group and all its topics, send an email to wxpython-users+unsubscribe@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

Phone: 650-948-8037
Email: RobinLRandall@gmail.com
Mountain View, CA 94041

Hi Tim,

I removed the “!note below” comment and it still fails on “sqlite3” token.

I am using the 5.2 version. You should be able to reproduce the results

with the two files I included.

Thanks,

Robin

···

On Sun, Feb 22, 2015 at 10:14 PM, Tim Roberts timr@probo.com wrote:

On Feb 21, 2015, at 1:39 PM, RLRandallx robinlrandall@gmail.com wrote:

Simple DBTEST.py module will not pass grammar test. “sqlite3” wiill not pass basically an {AlphaNumeric}+ specification. I’ve tried

{Letter}{AlphaNumeric}* and others but nothing works. Grammar “compiles” fine with no errors. I can’t see anything wrong with “‘import’ NAME” rule.

Right, because I believe the problem isn’t the “import” statement, it’s the comment before it. Do you understand that ! is the comment character in that parser? All lines starting with ! are ignored.

Tim Roberts, timr@probo.com

Providenza & Boekelheide, Inc.

You received this message because you are subscribed to a topic in the Google Groups “wxPython-users” group.

To unsubscribe from this topic, visit https://groups.google.com/d/topic/wxpython-users/27K9TI3_cS4/unsubscribe.

To unsubscribe from this group and all its topics, send an email to wxpython-users+unsubscribe@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

Phone: 650-948-8037
Email: RobinLRandall@gmail.com
Mountain View, CA 94041

Robin Randall wrote:

Hi Tim,

I do understand the use of "!" but I thought I could intersperse lines
anywhere in
the grammar.

Well, yes, but for example you have this:

Comment Line = '#'
!
Whitespace = {WS}+
! | '#'{Printable}*

I think you were trying to say that that "# followed by printable
characters" represents whitespace, but that's not what this does. That
whole fourth line is completely ignored. It's a comment.

There are number of lines in your file that seem important but that are
commented out.

···

--
Tim Roberts, timr@probo.com
Providenza & Boekelheide, Inc.

Got it.
Robin

···

On Mon, Feb 23, 2015 at 2:49 PM, Tim Roberts timr@probo.com wrote:

Robin Randall wrote:

Hi Tim,

I do understand the use of “!” but I thought I could intersperse lines

anywhere in

the grammar.

Well, yes, but for example you have this:

Comment Line = ‘#’

!

Whitespace = {WS}+

! | ‘#’{Printable}*

I think you were trying to say that that "# followed by printable

characters" represents whitespace, but that’s not what this does. That

whole fourth line is completely ignored. It’s a comment.

There are number of lines in your file that seem important but that are

commented out.

Tim Roberts, timr@probo.com

Providenza & Boekelheide, Inc.

You received this message because you are subscribed to a topic in the Google Groups “wxPython-users” group.

To unsubscribe from this topic, visit https://groups.google.com/d/topic/wxpython-users/27K9TI3_cS4/unsubscribe.

To unsubscribe from this group and all its topics, send an email to wxpython-users+unsubscribe@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

Phone: 650-948-8037
Email: RobinLRandall@gmail.com
Mountain View, CA 94041

Hi Tim,

I got rid of all grammar lines with ‘#’. Only below remains.

Comment Line = ‘#’

But it still fails at the ‘import’ line. Are you still convinced the problem is with the comment

or the way I get past blank lines? Until I found that was my problem. I feel there

should be a defined way to pass by “{Whitespace}*{NewLine}” types of lines.Something like:

Blank Line = {WS}*{NewLine} (where {WS} = {Whitespace} - {CR} - {LF} )

is similar to “Comment Line” and would do the trick.

Thanks for your help,

Robin

···

On Sun, Feb 22, 2015 at 10:14 PM, Tim Roberts timr@probo.com wrote:

On Feb 21, 2015, at 1:39 PM, RLRandallx robinlrandall@gmail.com wrote:

Simple DBTEST.py module will not pass grammar test. “sqlite3” wiill not pass basically an {AlphaNumeric}+ specification. I’ve tried

{Letter}{AlphaNumeric}* and others but nothing works. Grammar “compiles” fine with no errors. I can’t see anything wrong with “‘import’ NAME” rule.

Right, because I believe the problem isn’t the “import” statement, it’s the comment before it. Do you understand that ! is the comment character in that parser? All lines starting with ! are ignored.

Tim Roberts, timr@probo.com

Providenza & Boekelheide, Inc.

You received this message because you are subscribed to a topic in the Google Groups “wxPython-users” group.

To unsubscribe from this topic, visit https://groups.google.com/d/topic/wxpython-users/27K9TI3_cS4/unsubscribe.

To unsubscribe from this group and all its topics, send an email to wxpython-users+unsubscribe@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

Phone: 650-948-8037
Email: RobinLRandall@gmail.com
Mountain View, CA 94041

Robin Randall wrote:

I got rid of all grammar lines with '#'. Only below remains.

Comment Line = '#'

But it still fails at the 'import' line. Are you still convinced the
problem is with the comment
or the way I get past blank lines?

No, I'm not convinced, because I don't know the GOLDParser product at
all. I just saw something that looked unusual.

I AM convinced that this is a GOLDParser problem, not a wxPython
problem. You would have much better luck asking on the GOLDParser forums.

···

--
Tim Roberts, timr@probo.com
Providenza & Boekelheide, Inc.

Thanks, I’ll do that.
Robin

···

On Tue, Feb 24, 2015 at 9:39 AM, Tim Roberts timr@probo.com wrote:

Robin Randall wrote:

I got rid of all grammar lines with ‘#’. Only below remains.

Comment Line = ‘#’

But it still fails at the ‘import’ line. Are you still convinced the

problem is with the comment

or the way I get past blank lines?

No, I’m not convinced, because I don’t know the GOLDParser product at

all. I just saw something that looked unusual.

I AM convinced that this is a GOLDParser problem, not a wxPython

problem. You would have much better luck asking on the GOLDParser forums.

Tim Roberts, timr@probo.com

Providenza & Boekelheide, Inc.

You received this message because you are subscribed to a topic in the Google Groups “wxPython-users” group.

To unsubscribe from this topic, visit https://groups.google.com/d/topic/wxpython-users/27K9TI3_cS4/unsubscribe.

To unsubscribe from this group and all its topics, send an email to wxpython-users+unsubscribe@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

Phone: 650-948-8037
Email: RobinLRandall@gmail.com
Mountain View, CA 94041