diff --git a/changelog.md b/changelog.md index 7971cf4..38b6dfa 100644 --- a/changelog.md +++ b/changelog.md @@ -1,40 +1,44 @@ # Changelog + +# 2.1.0 +- Added support for multiplex signal parsing and syntax highlighting +- Reversed changelog order -# 1.0.0: -- Initial release +# 2.0.0 +- Restructure of entire extension +- Added DBCLib to contain all components of dbc file +- Separated client and server code +- Added react-based side window that shows basic preview of messages & signals -# 1.0.1: -- Updated package description +# 1.2.3 +- Fixed crashing issue that prevented parsing +- Added option to silence warnings from undefined objects -# 1.0.2: -- Fixed comment wrapping -- Fixed scientific notation in min/max and factor/offset -- Updated package metadata +# 1.2.2 +- Added more useful errors and warnings +- Fixed line number that error occurs on when present +- Changed when parse occurs (now on save) -# 1.0.3: -- Updated first line matching +# 1.2.1 +- Fixed vscode_ignore to exclude node_modules -# 1.1.0: -- Added basic snippets - # 1.2.0 - Promoted to internal language server - Serves as a parser and throws basic parser and lexer errors -# 1.2.1 -- Fixed vscode_ignore to exclude node_modules +# 1.1.0: +- Added basic snippets + +# 1.0.3: +- Updated first line matching -# 1.2.2 -- Added more useful errors and warnings -- Fixed line number that error occurs on when present -- Changed when parse occurs (now on save) +# 1.0.2: +- Fixed comment wrapping +- Fixed scientific notation in min/max and factor/offset +- Updated package metadata -# 1.2.3 -- Fixed crashing issue that prevented parsing -- Added option to silence warnings from undefined objects +# 1.0.1: +- Updated package description -# 2.0.0 -- Restructure of entire extension -- Added DBCLib to contain all components of dbc file -- Separated client and server code -- Added react-based side window that shows basic preview of messages & signals +# 1.0.0: +- Initial release diff --git a/dbcLib/src/dbc/signal.ts b/dbcLib/src/dbc/signal.ts index 0a33983..fdf636d 100644 --- a/dbcLib/src/dbc/signal.ts +++ b/dbcLib/src/dbc/signal.ts @@ -29,7 +29,8 @@ export class Signal { Min: number, Max: number, Unit: string, - Receivers: string[]){ + Receivers: string[], + MultiplexIndicator: string | null = null){ this.name = Name; this.startBit = Start; this.bitSize = Size; @@ -46,6 +47,7 @@ export class Signal { this.attributes = new Map(); this.lineNum = lineNo; this.clsType = "signal"; + this.multiplexIndicator = MultiplexIndicator; } public name: string; @@ -64,6 +66,7 @@ export class Signal { public attributes: Map; public lineNum: number; public clsType: string; + public multiplexIndicator: string | null; // null: no multiplex, 'M': multiplexor, 'mX': multiplexed signal } export class SignalType{ diff --git a/package.json b/package.json index d71220a..e998eec 100644 --- a/package.json +++ b/package.json @@ -7,7 +7,7 @@ "url": "https://github.com/lharri73/DBC-Language-Syntax" }, "license": "GPL-2.0-only", - "version": "2.0.0", + "version": "2.1.0", "publisher": "lharri73", "engines": { "vscode": "^1.43.0" diff --git a/server/dbc.jison b/server/dbc.jison index c64f9a8..80a5f38 100644 --- a/server/dbc.jison +++ b/server/dbc.jison @@ -48,6 +48,8 @@ const db = new dbclib.Database(); %token DECIMAL // %token DBC_WORD %token ENDOFFILE +%token MULTIPLEXOR +%token MULTIPLEXED %% @@ -210,23 +212,32 @@ signals $$.set($2.name, $2); }; signal - : SG UNSAFE_WORD /*multiplexer*/ COLON DECIMAL VBAR DECIMAL AT + : SG UNSAFE_WORD multiplex_indicator COLON DECIMAL VBAR DECIMAL AT byte_order signal_val_type OPEN_PAREN number COMMA number CLOSE_PAREN OPEN_BRACK number VBAR number CLOSE_BRACK QUOTED_STRING receivers EOL { $$ = new dbclib.Signal(yylineno, - /*name: */$2, - /*start: */Number($4), - /*size: */Number($6), - /*order: */$8, - /*type: */$9, - /*factor:*/$11, - /*offset:*/$13, - /*min: */$16, - /*max: */$18, - /*unit: */$20, - /*recs: */$21); + /*name: */$2, + /*start: */Number($5), + /*size: */Number($7), + /*order: */$9, + /*type: */$10, + /*factor: */$12, + /*offset: */$14, + /*min: */$17, + /*max: */$19, + /*unit: */$21, + /*recs: */$22, + /*multiplexInd: */$3); }; +multiplex_indicator + : %empty {$$ = null;} + | multiplex_token {$$ = $1;}; + +multiplex_token + : MULTIPLEXOR {$$ = 'M';} + | MULTIPLEXED {$$ = $1;}; + byte_order : DECIMAL { if( $1 == 0 ){ diff --git a/server/dbc.lex b/server/dbc.lex index 17de90d..9c47878 100644 --- a/server/dbc.lex +++ b/server/dbc.lex @@ -61,6 +61,8 @@ DEFINER (?![a-zA-Z]) "VAL_TABLE_"{DEFINER} {return "VAL_TABLE"} "VECTOR_XXX"{DEFINER} {return "VECTOR_XXX"} "VERSION" {return "VERSION"} +"M"{DEFINER} {return "MULTIPLEXOR"} +"m"{DIGIT}+{DEFINER} {yytext = yytext; return "MULTIPLEXED";} // punctuation "|" {return "VBAR"} diff --git a/syntaxSrc/dbcLang.yml b/syntaxSrc/dbcLang.yml index c5adca4..aba8d09 100644 --- a/syntaxSrc/dbcLang.yml +++ b/syntaxSrc/dbcLang.yml @@ -162,15 +162,17 @@ repository: match: "," patterns: - - match: "^\\s*(SG_)\\s*(\\w*)\\s*(:?)\\s*(.*?[+-])?\\s*(\\(.*\\))?\\s*(\\[.*\\])?\\s*(\".*\")?\\s*((?(7).*|))$" + - match: "^\\s*(SG_)\\s*(\\w*)\\s*((M|m\\d+)\\s*)?(:?)\\s*(.*?[+-])?\\s*(\\(.*\\))?\\s*(\\[.*\\])?\\s*(\".*\")?\\s*((?(9).*|))$" captures: 1: name: keyword.control.signal.dbc 2: name: variable.parameter.sigName.dbc meta.signal.name.dbc - 3: - name: punctuation.qualifier.dbc 4: + name: meta.signal.multiplexIndicator.dbc + 5: + name: punctuation.qualifier.dbc + 6: patterns: - match: "(\\d*)(\\|?)(\\d*)(@?)([01]?)([+-]?)" captures: @@ -186,7 +188,7 @@ repository: name: constant.numeric.binary.dbc meta.signal.byteOrder.dbc 6: name: punctuation.sign.dbc meta.signal.signed.dbc - 5: + 7: patterns: - match: "(\\(?)((?>-?\\d+\\.?\\d*E?\\+?\\d*)?)\\s*(,?)\\s*((?>-?\\d+\\.?\\d*E?\\+?\\d*)?)\\s*(\\)?)" captures: @@ -200,7 +202,7 @@ repository: name: constant.numeric.decimal.dbc meta.signal.offset.dbc 5: name: punctuation.definition.factorOffset.end.dbc - 6: + 8: patterns: - match: "(\\[?)(-?\\d+\\.?\\d*E?\\+?\\d*)(\\|?)(-?\\d+\\.?\\d*E?\\+?\\d*)(\\]?)" captures: @@ -214,11 +216,11 @@ repository: name: constant.numeric.decimal.dbc meta.signal.maximum.dbc 5: name: punctuation.definition.minMax.end.dbc - 7: + 9: name: meta.signal.unit.dbc patterns: - include: "#strings" - 8: + 10: patterns: - name: variable.language.nodeName.dbc match: "\\w+"