grammars-v4 icon indicating copy to clipboard operation
grammars-v4 copied to clipboard

Updated PHP Grammar Documentation about Python Runtimes

Open dkazantzas opened this issue 3 years ago • 15 comments

Added a section in the README.md of the PHP Grammar so that users can address the issue that is reported in #2730

dkazantzas avatar Jul 27 '22 11:07 dkazantzas

I've followed the suggestion by @kaby76 in the discussion of #2730 and added a script to transform the Grammar

dkazantzas avatar Jul 28 '22 12:07 dkazantzas

Please also remove the "php" line from the skip-python3.txt file. The file tells the build script to "skip" doing the build for the "php/" grammar. When the line is removed, the build will attempt to run regression tests on the grammar.

kaby76 avatar Jul 28 '22 15:07 kaby76

Ok done.

dkazantzas avatar Jul 28 '22 16:07 dkazantzas

Almost there.

  • The directory php/Python/ should be renamed php/Python3/. There really isn't a "Python" target, but either "Python2" or "Python3". The build script checks for the directory corresponding to the target, then copies the code to the directory containing the .g4 files.
  • There are two syntax errors in PhpLexer.py. To correct, update transformGrammar.py with the a few lines to change "true" to "True". Context is added because there is a grammar option with "true" that shouldn't be changed.
$ diff dkazantzas/php/Python/transformGrammar.py dkazantzas2/php/Python/
30,33d29
<         if '_scriptTag = true;' in x:
<             x = x.replace('_scriptTag = true;', '_scriptTag = True;')
<         if '_styleTag = true;' in x:
<             x = x.replace('_styleTag = true;', '_styleTag = True;')
  • The PhpParserBase.py file looks like it contains an error.
$ diff dkazantzas/php/Python/PhpLexerBase.py  dkazantzas2/php/Python/
121c121
<             self._channel = self.SKIP
---
>             self.channel(SkipChannel)

kaby76 avatar Jul 29 '22 00:07 kaby76

Made those changes too. I really appreciate your help in this.

dkazantzas avatar Jul 30 '22 15:07 dkazantzas

@teverett This PR is okay--good changes. The build failed with the usual "Connection closed before full header was received" in Dart only. Not sure what to do about these Dart download failures. I'll check around.

kaby76 avatar Aug 05 '22 13:08 kaby76

@kaby76 thanks. Let's fix the Dart issue before it gets pulled.

teverett avatar Aug 06 '22 18:08 teverett

@kaby76 thanks. Let's fix the Dart issue before it gets pulled.

@teverett

I created a Github Issue for this https://github.com/antlr/grammars-v4/issues/2743

As I explained there, we've been getting a "Connection closed before full header was received" on Window and Macos. I think it's because the network connection for the Github Actions servers or (more likely) the Dart servers are boxes of unreliable junk. It could be both.

To work around this problem I will submit a separate PR to retry the "dart pub get" until the return code is zero or some could like 10x's.

Could you invoke the action for this PR again in order to test the non-determinism of the machines?

kaby76 avatar Aug 06 '22 19:08 kaby76

@kaby76 yup!

teverett avatar Aug 06 '22 20:08 teverett

@teverett Thanks. It happened again. I'll check it out locally on my machines to see what I can do.

kaby76 avatar Aug 06 '22 20:08 kaby76

@teverett I created a PR to wrap the "dart pub get" in a loop to repeat on error. It doesn't hurt the build, may help in these dart connection drops, but who knows? Once merged, maybe this PR can be rebased and checked?

kaby76 avatar Aug 07 '22 10:08 kaby76

@dkazantzas Please fast forward your repo so it can be rebuilt.

kaby76 avatar Aug 08 '22 13:08 kaby76

@kaby76 Done

dkazantzas avatar Aug 08 '22 13:08 dkazantzas

@dkazantzas That looks good. @teverett Build? Let's see if this works.

kaby76 avatar Aug 08 '22 13:08 kaby76

The Dart build works on Macos, Windows, and Ubuntu. Now it's the Go target. I'll enter a Github Issue for that.

kaby76 avatar Aug 08 '22 17:08 kaby76

@dkazantzas Please fast forward your repo so it can be rebuilt with the latest fixes for Go builds. Thanks.

kaby76 avatar Aug 19 '22 10:08 kaby76

@kaby76 I've synced my repo, it should now be ok

dkazantzas avatar Aug 19 '22 13:08 dkazantzas

@teverett This is ready to rebuild. Could you set a build going? I think we should no longer have Dart and Go build errors, but let's just see. Thanks.

kaby76 avatar Aug 19 '22 14:08 kaby76

@kaby76 done, thanks for the reminder.

teverett avatar Aug 19 '22 15:08 teverett

@teverett Works perfectly.

kaby76 avatar Aug 19 '22 18:08 kaby76

@dkazantzas @kaby76 thanks

teverett avatar Aug 19 '22 19:08 teverett