diff --git a/source/engine/grammar.ne b/source/engine/grammar.ne index 025a3a6c9..27121c7fc 100644 --- a/source/engine/grammar.ne +++ b/source/engine/grammar.ne @@ -13,12 +13,12 @@ const moo = require("moo"); const letter = '[a-zA-Z\u00C0-\u017F]'; const letterOrNumber = '[a-zA-Z\u00C0-\u017F0-9\']'; const word = `${letter}(?:[\-']?${letterOrNumber}+)*`; -const numberRegExp = '-?(?:[1-9][0-9]+|[0-9])(?:\.[0-9]+)?'; +const wordOrNumber = `(?:${word}|${letterOrNumber}+)` +const words = `${word}(?:[\\s]?${wordOrNumber}+)*` +const numberRegExp = '-?(?:[1-9][0-9]+|[0-9])(?:\\.[0-9]+)?'; const percentageRegExp = numberRegExp + '\\%' - const lexer = moo.compile({ percentage: new RegExp(percentageRegExp), - number: new RegExp(numberRegExp), '(': '(', ')': ')', '[': '[', @@ -26,7 +26,8 @@ const lexer = moo.compile({ comparison: ['>','<','>=','<=','=','!='], additionSubstraction: /[\+-]/, multiplicationDivision: ['*','/'], - word: new RegExp(word), + words: new RegExp(words), + number: new RegExp(numberRegExp), string: /'[ \t\.'a-zA-Z\-\u00C0-\u017F0-9 ]+'/, '€': '€', dot: ' . ', @@ -67,17 +68,15 @@ NonNumericTerminal -> boolean {% id %} | string {% id %} -Words -> %word (%space (%word {% id %} | %letterOrNumber {% id %}) {% join %}):* {% flattenJoin %} - -Variable -> Words (%dot Words {% ([,words]) => words %}):* {% variable %} +Variable -> %words (%dot %words {% ([,words]) => words %}):* {% variable %} BaseUnit -> - %word {% id %} + %words {% id %} | "€" {% id %} Unit -> BaseUnit ("/" BaseUnit {% join %}):? {% join %} -Filter -> "[" Words "]" {% ([,filter]) => filter %} +Filter -> "[" %words "]" {% ([,filter]) => filter %} FilteredVariable -> Variable %space Filter {% filteredVariable %} TemporalTransform -> "[" ("mensuel" | "annuel" {% id %}) "]" {% ([,temporality]) => temporality %} diff --git a/source/règles/base.yaml b/source/règles/base.yaml index f6df1523d..832a9bac8 100644 --- a/source/règles/base.yaml +++ b/source/règles/base.yaml @@ -1114,7 +1114,7 @@ contrat salarié . SMIC temps plein . net imposable: période: mois unité: € description: Montant du SMIC net imposable - formule: 1247,55 + formule: 1247.55 note: Ce montant est codé en dur, il faudrait le calculer à partir du montant du SMIC brut références: barème PAS: https://bofip.impots.gouv.fr/bofip/11255-PGP.html @@ -2310,7 +2310,7 @@ contrat salarié . chômage . taux salarié: formule: 0% contrat salarié . chômage . taux employeur: - formule: 4.05 % + formule: 4.05% contrat salarié . complémentaire santé: