EugeneMeles / laravel-react-i18n

Allows to connect your `Laravel` Framework translation files with `React`.
MIT License
73 stars 8 forks source link

Error: Bad terminal sequence "" at line 2 (offset 8) #12

Closed parth391 closed 1 year ago

parth391 commented 1 year ago

Error coming in v2.0.3

error when starting dev server:
Error: Bad terminal sequence "" at line 2 (offset 8)
    at Lexer.matchST_IN_SCRIPTING (/.../example-app/node_modules/php-parser/src/lexer/scripting.js:92:11)
    at Lexer.next (/.../example-app/node_modules/php-parser/src/lexer.js:511:26)
    at Lexer.lex (/.../example-app/node_modules/php-parser/src/lexer.js:423:20)
    at Lexer.lex (/.../example-app/node_modules/php-parser/src/lexer.js:413:35)
    at Parser.lex (/.../example-app/node_modules/php-parser/src/parser.js:702:29)
    at Parser.next (/.../example-app/node_modules/php-parser/src/parser.js:611:8)
    at Parser.parse (/.../example-app/node_modules/php-parser/src/parser.js:299:8)
    at Engine.parseCode (/.../example-app/node_modules/php-parser/src/index.js:187:22)
    at fromString (/.../example-app/node_modules/php-array-reader/index.js:26:24)
    at /.../example-app/node_modules/laravel-react-i18n/dist/plugin/parser.js:62:61
EugeneMeles commented 1 year ago

This error is thrown during parsing /lang/*/*.php. If you previously had the 'php-parser' library installed, check its version, it should be 3.1.4. and 'php-array-reader'(1.3.5).

parth391 commented 1 year ago

Installing the php-array-reader 1.3.5 and php-parser 3.1.4 library, give same problem.

EugeneMeles commented 1 year ago

There is a suspicion on the translation php-file. Can you provide this repo?

EugeneMeles commented 1 year ago

I am creating a playground repo(Docker+Laravel) at laravel-react-i18n-playground You can use it as a base.

parth391 commented 1 year ago

This error comes when there is empty folder in /lang/.

EugeneMeles commented 1 year ago

Repeated with empty directories in /lang/ it's fine(( output below. image

EugeneMeles commented 1 year ago

From error trace ch variable set empty value. Pass in switch-case is failed and got throw. https://github.com/glayzzle/php-parser/blob/main/src/lexer/scripting.js#LL9C9-L9C9 Better way use breakpoint for debug, but I can't repeat this behavior 😔

parth391 commented 1 year ago

I am not facing this issue anymore.

Thanks