Repository navigation
Fix named expression names that start with a valid cell reference #1130
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 21 commits
Commits
Show all changes
26 commits
Select commit
Hold shift + click to select a range
39612be
Fix typos in the docs
sequba 1f9d47c
Change CellReference token to make lexer destinguish between CellRefe…
sequba 9419ce4
Add typedoc to NamedExpressions.isNameValid method
sequba f337190
Add unit tests for named expression names that starts with a valid ce…
sequba 441443a
Fix unit tests
sequba c47292f
Fix linter errors
sequba dec33fe
Add more tests for valid named expression names
sequba efba48b
Describe the actual rules for valid named expression names
sequba 088556a
Add changelog entry
sequba 1a06b3b
Make R1C1-style cell references not allowed as named expression names
sequba ca7e3cf
Create CellReferenceMatcher and NamedExpressionMatcher classes
sequba 4778ecd
Reuse the parser/lexer regexps inside NamedExpressions.isNameValid me…
sequba c5f4100
Refactor parser-consts
sequba 0181390
Refactor ProcedureName token
sequba 657dcb0
Refactor token for ColumnRange and RowRange
sequba 8747298
Rename ILexerConfig to LexerConfig
sequba e751da2
Add typedoc strings for the newly created code entities
sequba 84f71f7
Create ALL_UNICODE_LETTERS_ARRAY const
sequba c146cea
Refactor ALL_UNICODE_LETTERS_ARRAY
sequba 7b09872
Describe the difference in named expression names validity in the lis…
sequba 3c2e12c
Explain the default value for maxColumns config param
sequba 724b2b0
Make list-of-differences table more logical
sequba 1f28b0f
Minor docs improvements
sequba 5ccab33
Refactor parser consts
sequba 8fe9bb7
Add more unit tests for special cases of a named expression name
sequba 0edd6cc
Merge branch 'develop' into feature/issue-1058
sequba File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,46 @@ | ||
| /** | ||
| * @license | ||
| * Copyright (c) 2022 Handsoncode. All rights reserved. | ||
| */ | ||
|
|
||
| import { | ||
| ABSOLUTE_OPERATOR, ALL_UNICODE_LETTERS_ARRAY, | ||
| CELL_REFERENCE_PATTERN, | ||
| NON_RESERVED_CHARACTER_PATTERN | ||
| } from './parser-consts' | ||
|
|
||
| const CELL_REFERENCE_WITH_NEXT_CHARACTER_PATTERN = `(${CELL_REFERENCE_PATTERN})[^${NON_RESERVED_CHARACTER_PATTERN}]` | ||
|
|
||
| /** | ||
| * Helper class for recognizing CellReference token in text | ||
| */ | ||
| export class CellReferenceMatcher { | ||
| readonly POSSIBLE_START_CHARACTERS = [ | ||
| ...ALL_UNICODE_LETTERS_ARRAY, | ||
| ...Array.from(Array(10)).map((_, i) => i + '0'.charCodeAt(0)).map(code => String.fromCharCode(code)), | ||
|
sequba marked this conversation as resolved.
Resolved
|
||
| ABSOLUTE_OPERATOR, | ||
| "'", | ||
| '_', | ||
| ] | ||
|
|
||
| private cellReferenceRegexp = new RegExp(CELL_REFERENCE_WITH_NEXT_CHARACTER_PATTERN, 'y') | ||
|
|
||
| /** | ||
| * Method used by the lexer to recognize CellReference token in text | ||
| * | ||
| * Note: using 'y' sticky flag for a named expression which is not supported on IE11... | ||
| * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp/sticky | ||
| */ | ||
| match(text: string, startOffset: number): RegExpExecArray | null { | ||
| this.cellReferenceRegexp.lastIndex = startOffset | ||
|
|
||
| const execResult = this.cellReferenceRegexp.exec(text+'@') | ||
|
|
||
| if (execResult == null || execResult[1] == null) { | ||
| return null | ||
| } | ||
|
|
||
| execResult[0] = execResult[1] | ||
| return execResult | ||
| } | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.