From 6cc55a132db1664f95d89960f7402b172df39872 Mon Sep 17 00:00:00 2001 From: Phodal Huang Date: Sat, 29 Aug 2020 11:20:29 +0800 Subject: [PATCH] docs: add rule map not align --- docs/adr/0003-rule-map-not-align-issue.md | 51 +++++++++++++++++++++++ docs/adr/README.md | 1 + scie-grammar/src/grammar/grammar/mod.rs | 2 - 3 files changed, 52 insertions(+), 2 deletions(-) create mode 100644 docs/adr/0003-rule-map-not-align-issue.md diff --git a/docs/adr/0003-rule-map-not-align-issue.md b/docs/adr/0003-rule-map-not-align-issue.md new file mode 100644 index 0000000..d0fbbb4 --- /dev/null +++ b/docs/adr/0003-rule-map-not-align-issue.md @@ -0,0 +1,51 @@ +# 3. rule map not align issue + +Date: 2020-08-29 + +## Status + +2020-08-29 proposed + +## Context + +In currently, the [VSCode-textmate](https://github.com/microsoft/vscode-textmate) generated ruleid2rule has some duplicated fields. + +```json + { + "id": 15, + "_name": "punctuation.definition.variable.makefile", + "_nameIsCapturing": false, + "_contentName": null, + "_contentNameIsCapturing": false, + "retokenizeCapturedWithRuleId": 0, + "_type": "CaptureRule" + }, + { + "id": 16, + "_name": "punctuation.definition.variable.makefile", + "_nameIsCapturing": false, + "_contentName": null, + "_contentNameIsCapturing": false, + "retokenizeCapturedWithRuleId": 0, + "_type": "CaptureRule" + } +``` + +But in our case with Rust, if we don't merge those field, we will had issues. So we decide to merge it will name. + +The issues is `stackoverflow`, ::laughing::::laughing::::laughing:: + +``` +thread 'grammar::grammar::tests::should_build_makefile_grammar' has overflowed its stack +fatal runtime error: stack overflow +error: test failed, to rerun pass '-p scie-grammar --lib' +``` + + +## Decision + +Decision here... + +## Consequences + +Consequences here... diff --git a/docs/adr/README.md b/docs/adr/README.md index 871d4e5..db19fb2 100644 --- a/docs/adr/README.md +++ b/docs/adr/README.md @@ -2,3 +2,4 @@ * [1. base-language-choice](0001-base-language-choice.md) * [2. grammer-engine-choice](0002-grammer-engine-choice.md) +* [3. rule-map-not-align-issue](0003-rule-map-not-align-issue.md) diff --git a/scie-grammar/src/grammar/grammar/mod.rs b/scie-grammar/src/grammar/grammar/mod.rs index 7f67e4d..7470658 100644 --- a/scie-grammar/src/grammar/grammar/mod.rs +++ b/scie-grammar/src/grammar/grammar/mod.rs @@ -31,7 +31,6 @@ pub struct ITokenizeLineResult2 { pub trait IGrammar { fn tokenize_line(line_text: String, prev_state: Option) -> ITokenizeLineResult; - /** * Tokenize `lineText` using previous line state `prevState`. * The result contains the tokens in binary format, resolved with the following information: @@ -134,7 +133,6 @@ impl Grammar { check_while_conditions: bool, ) { let line_length = line_text.len(); - let mut stop = false; let mut anchor_position = -1; -- GitLab