ether-code 0.9.1 → 0.9.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cli/ether.js +1 -1
- package/generators/php-generator.js +801 -738
- package/lexer/ether-lexer.js +5 -3
- package/package.json +1 -1
- package/parsers/ether-parser-php.js +14 -4
package/lexer/ether-lexer.js
CHANGED
|
@@ -307,7 +307,7 @@ class EtherLexer {
|
|
|
307
307
|
this.tokens.push(new Token(TokenType.DEDENT, '', this.line, 1, indent))
|
|
308
308
|
}
|
|
309
309
|
if (this.indentStack[this.indentStack.length - 1] !== indent) {
|
|
310
|
-
this.tokens.push(new Token(TokenType.ERROR, 'Indentation incoh
|
|
310
|
+
this.tokens.push(new Token(TokenType.ERROR, 'Indentation incohérente', this.line, 1, indent))
|
|
311
311
|
}
|
|
312
312
|
}
|
|
313
313
|
}
|
|
@@ -419,7 +419,7 @@ class EtherLexer {
|
|
|
419
419
|
break
|
|
420
420
|
}
|
|
421
421
|
if (this.peek() === '\n') {
|
|
422
|
-
this.tokens.push(new Token(TokenType.ERROR, 'Cha
|
|
422
|
+
this.tokens.push(new Token(TokenType.ERROR, 'Chaîne non terminée', startLine, startCol, this.currentIndent))
|
|
423
423
|
return
|
|
424
424
|
}
|
|
425
425
|
}
|
|
@@ -684,6 +684,7 @@ class EtherLexer {
|
|
|
684
684
|
'sous chaine', 'couper espaces', 'encoder json', 'decoder json',
|
|
685
685
|
'fichier existe', 'lire fichier', 'ecrire fichier',
|
|
686
686
|
'somme tableau', 'filtrer tableau', 'mapper tableau',
|
|
687
|
+
'fusionner tableaux', 'reduire tableau', 'inverser tableau',
|
|
687
688
|
'compter elements', 'tableau cles', 'tableau valeurs',
|
|
688
689
|
'hacher mot', 'verifier mot',
|
|
689
690
|
'hacher mot de', 'verifier mot de',
|
|
@@ -754,6 +755,7 @@ class EtherLexer {
|
|
|
754
755
|
'sous chaine', 'couper espaces', 'encoder json', 'decoder json',
|
|
755
756
|
'fichier existe', 'lire fichier', 'ecrire fichier',
|
|
756
757
|
'somme tableau', 'filtrer tableau', 'mapper tableau',
|
|
758
|
+
'fusionner tableaux', 'reduire tableau', 'inverser tableau',
|
|
757
759
|
'compter elements', 'tableau cles', 'tableau valeurs',
|
|
758
760
|
'hacher mot', 'verifier mot',
|
|
759
761
|
'hacher mot de passe', 'verifier mot de passe',
|
|
@@ -999,7 +1001,7 @@ class EtherLexer {
|
|
|
999
1001
|
break
|
|
1000
1002
|
|
|
1001
1003
|
default:
|
|
1002
|
-
this.tokens.push(new Token(TokenType.ERROR, `Caract
|
|
1004
|
+
this.tokens.push(new Token(TokenType.ERROR, `Caractère inattendu: ${char}`, startLine, startCol, this.currentIndent))
|
|
1003
1005
|
}
|
|
1004
1006
|
}
|
|
1005
1007
|
|
package/package.json
CHANGED
|
@@ -533,6 +533,16 @@ class EtherParserPHP extends EtherParserBase {
|
|
|
533
533
|
})
|
|
534
534
|
} while (this.match(TokenType.COMMA))
|
|
535
535
|
|
|
536
|
+
if (imports.length === 1) {
|
|
537
|
+
return {
|
|
538
|
+
type: 'UseStatement',
|
|
539
|
+
useType: useType,
|
|
540
|
+
name: imports[0].path,
|
|
541
|
+
alias: imports[0].alias,
|
|
542
|
+
imports: imports
|
|
543
|
+
}
|
|
544
|
+
}
|
|
545
|
+
|
|
536
546
|
return {
|
|
537
547
|
type: 'UseStatement',
|
|
538
548
|
useType: useType,
|
|
@@ -1337,7 +1347,7 @@ class EtherParserPHP extends EtherParserBase {
|
|
|
1337
1347
|
|
|
1338
1348
|
alternate = {
|
|
1339
1349
|
type: 'IfStatement',
|
|
1340
|
-
|
|
1350
|
+
test: elseCondition,
|
|
1341
1351
|
consequent: elseConsequent,
|
|
1342
1352
|
alternate: null
|
|
1343
1353
|
}
|
|
@@ -1366,7 +1376,7 @@ class EtherParserPHP extends EtherParserBase {
|
|
|
1366
1376
|
|
|
1367
1377
|
return {
|
|
1368
1378
|
type: 'IfStatement',
|
|
1369
|
-
|
|
1379
|
+
test: condition,
|
|
1370
1380
|
consequent: consequent,
|
|
1371
1381
|
alternate: alternate
|
|
1372
1382
|
}
|
|
@@ -1695,7 +1705,7 @@ class EtherParserPHP extends EtherParserBase {
|
|
|
1695
1705
|
|
|
1696
1706
|
return {
|
|
1697
1707
|
type: 'WhileStatement',
|
|
1698
|
-
|
|
1708
|
+
test: condition,
|
|
1699
1709
|
body: body
|
|
1700
1710
|
}
|
|
1701
1711
|
}
|
|
@@ -1726,7 +1736,7 @@ class EtherParserPHP extends EtherParserBase {
|
|
|
1726
1736
|
return {
|
|
1727
1737
|
type: 'DoWhileStatement',
|
|
1728
1738
|
body: body,
|
|
1729
|
-
|
|
1739
|
+
test: condition
|
|
1730
1740
|
}
|
|
1731
1741
|
}
|
|
1732
1742
|
|