Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix python3 parse error #3438

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Fix python3 parse error #3438

wants to merge 1 commit into from

Conversation

MR-BH
Copy link

@MR-BH MR-BH commented May 18, 2023

fix case like:

print(0)
print(1)

cause error
Parse error: {
startLine: 2,
endLine: 2,
startCol: 8,
endCol: 13,
message: "no viable alternative at input ''"
}

fix case like:
```
print(0)
print(1)
```
cause error
Parse error: {
      startLine: 2,
      endLine: 2,
      startCol: 8,
      endCol: 13,
      message: "no viable alternative at input '<EOF>'"
    }
@kaby76
Copy link
Contributor

kaby76 commented May 18, 2023

@MR-BH The Python3 target of the python/python3 grammar sometimes takes over 300s on a heavily loaded Github server, so the parse was killed. The test will need to be split or changed to individual parsing. For now, remove the target in the desc.xml.

<targets>CSharp;Java;Python3</targets>

Or, if you want to help fix this, change the desc.xml to this:

<?xml version="1.0" encoding="UTF-8" ?>
<desc xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../_scripts/desc.xsd">
   <antlr-version>^4.7</antlr-version>
   <targets>CSharp;Java;Python3</targets>
   <test>
      <targets>CSharp;Java;Python3</targets>
      <inputs>examples</inputs>
   </test>
   <test>
      <targets>CSharp;Java;Python3</targets>
      <inputs>long-examples</inputs>
   </test>
</desc>

Then, make a "long-examples" directory, and move these four .py tests to long-examples/:

mkdir long-examples
mv examples/base_events.py long-examples/
mv examples/selector_events.py long-examples/
mv examples/unix_events.py long-examples/
mv examples/windows_events.py long-examples/

Copy link
Member

@KvanTTT KvanTTT left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Welcome to ANTLR grammars repository!

But please add an example that covers suggested changes to the examples subdirectory.

@kaby76
Copy link
Contributor

kaby76 commented Jul 9, 2023

I restructured the python grammars, and restructured the tests in python3. Please update to the latest source and try again. Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants