From 2c42f5ba4fb869d55579f68d988feb593a4fa78c Mon Sep 17 00:00:00 2001 From: Nathan Schulte <8540239+nmschulte@users.noreply.github.com> Date: Thu, 14 Mar 2024 18:08:45 -0500 Subject: [PATCH] config [grammar] improves (#389) * add "units" field to config.txt comments * remove tabs in config grammar --- firmware/integration/rusefi_config.txt | 2 +- .../src/main/antlr/RusefiConfigGrammar.g4 | 20 +++++++++---------- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/firmware/integration/rusefi_config.txt b/firmware/integration/rusefi_config.txt index 43a60d8cab..7783f8a9bd 100644 --- a/firmware/integration/rusefi_config.txt +++ b/firmware/integration/rusefi_config.txt @@ -46,7 +46,7 @@ ! ! ! each field is declared as -! type name;comment;scale,offset,min,max,number_of_digits +! type name;comment;"units",scale,offset,min,max,number_of_digits ! hello;I like rusEFI;"ms",1,0,-10,10,2 ! ! diff --git a/java_tools/configuration_definition/src/main/antlr/RusefiConfigGrammar.g4 b/java_tools/configuration_definition/src/main/antlr/RusefiConfigGrammar.g4 index e3f140cafb..06d551d8b5 100644 --- a/java_tools/configuration_definition/src/main/antlr/RusefiConfigGrammar.g4 +++ b/java_tools/configuration_definition/src/main/antlr/RusefiConfigGrammar.g4 @@ -1,7 +1,7 @@ grammar RusefiConfigGrammar; @header { - package com.rusefi.generated; + package com.rusefi.generated; } // ...be generous in line endings... @@ -54,13 +54,13 @@ integer: IntegerChars; floatNum: FloatChars | IntegerChars; expr - : floatNum # EvalNumber - | '{' expr '}' # EvalParens - | expr MUL expr # EvalMul - | expr DIV expr # EvalDiv - | expr ADD expr # EvalAdd - | expr SUB expr # EvalSub - | replacementIdent # EvalReplacement + : floatNum # EvalNumber + | '{' expr '}' # EvalParens + | expr MUL expr # EvalMul + | expr DIV expr # EvalDiv + | expr ADD expr # EvalAdd + | expr SUB expr # EvalSub + | replacementIdent # EvalReplacement ; numexpr: expr; @@ -121,8 +121,8 @@ enumRhs | enumVal (',' enumVal)* ; -enumTypedefSuffix: /*ignored*/replacementIdent Bits ',' Datatype ',' '@OFFSET@' ',' '[' integer ':' integer ']' ',' enumRhs ; -scalarTypedefSuffix: /*ignored*/integer Scalar ',' Datatype ',' '@OFFSET@' fieldOptionsList ; +enumTypedefSuffix: /*ignored*/replacementIdent Bits ',' Datatype ',' '@OFFSET@' ',' '[' integer ':' integer ']' ',' enumRhs; +scalarTypedefSuffix: /*ignored*/integer Scalar ',' Datatype ',' '@OFFSET@' fieldOptionsList; stringTypedefSuffix: /*ignored*/replacementIdent 'string' ',' 'ASCII' ',' '@OFFSET@' ',' numexpr; typedef: Custom identifier (enumTypedefSuffix | scalarTypedefSuffix | stringTypedefSuffix);