Repository navigation
Pu/matrixinput #671
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
+375
−33
Merged
Pu/matrixinput #671
Changes from 16 commits
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
eb46c48
parsing of matrices
izulin e0104c9
size prediction
izulin 83f61bf
evaluation, parsing, unparsing
izulin cb02a3b
tests
izulin 142ece8
doc
izulin ed562ef
linter
izulin 213092b
compiles
izulin 027597f
linter
izulin a94ee47
extra config options
izulin 8054ed2
tests
izulin b0dc57f
config
izulin be763b4
Merge branch 'develop' into pu/matrixinput
izulin 1f8e21f
Update src/parser/FormulaParser.ts
izulin cec1c20
Merge branch 'develop' into pu/matrixinput
izulin 976541a
Merge branch 'develop' into pu/matrixinput
izulin 03b3bfc
doc
izulin 1a5d0c8
Merge branch 'develop' into pu/matrixinput
izulin 50b7aa2
Merge branch 'develop' into pu/matrixinput
izulin 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
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 |
|---|---|---|
|
|
@@ -13,6 +13,7 @@ import {ErrorMessage} from '../error-message' | |
| import {LicenseKeyValidityState} from '../helpers/licenseKeyValidator' | ||
| import {ColumnSearchStrategy} from '../Lookup/SearchStrategy' | ||
| import {Matrix, NotComputedMatrix} from '../Matrix' | ||
| import {Maybe} from '../Maybe' | ||
| import {NamedExpressions} from '../NamedExpressions' | ||
| import {NumberLiteralHelper} from '../NumberLiteralHelper' | ||
| // noinspection TypeScriptPreferShortImport | ||
|
|
@@ -23,6 +24,7 @@ import { | |
| ArithmeticHelper, | ||
| coerceRangeToScalar, | ||
| coerceScalarToString, | ||
| coerceToRange, | ||
| fixNegativeZero, | ||
| isNumberOverflow | ||
| } from './ArithmeticHelper' | ||
|
|
@@ -226,6 +228,38 @@ export class Interpreter { | |
| case AstNodeType.PARENTHESIS: { | ||
| return this.evaluateAst(ast.expression, state) | ||
| } | ||
| case AstNodeType.MATRIX: { | ||
| let totalWidth: Maybe<number> = undefined | ||
| const ret: InternalScalarValue[][] = [] | ||
| for(const astRow of ast.args) { | ||
| let rowHeight: Maybe<number> = undefined | ||
| const rowRet: InternalScalarValue[][] = [] | ||
| for(const astIt of astRow) { | ||
| const arr = coerceToRange(this.evaluateAst(astIt, state)) | ||
| const height = arr.height() | ||
| if(rowHeight===undefined) { | ||
| rowHeight = height | ||
| rowRet.push(...arr.data) | ||
| } else if(rowHeight === height) { | ||
| for(let i=0;i<height;i++) { | ||
| rowRet[i].push(...arr.data[i]) | ||
| } | ||
| } else { | ||
| return new CellError(ErrorType.REF, ErrorMessage.SizeMismatch) | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I would say it's
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
| } | ||
| } | ||
| const width = rowRet[0].length | ||
| if(totalWidth===undefined) { | ||
| totalWidth = width | ||
| ret.push(...rowRet) | ||
| } else if(totalWidth === width) { | ||
| ret.push(...rowRet) | ||
| } else { | ||
| return new CellError(ErrorType.REF, ErrorMessage.SizeMismatch) | ||
| } | ||
| } | ||
| return SimpleRangeValue.onlyValues(ret) | ||
| } | ||
| case AstNodeType.ERROR_WITH_RAW_INPUT: | ||
| case AstNodeType.ERROR: { | ||
| return ast.error | ||
|
|
||
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
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.

There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can't those parameters be in conflict together? ie. I set the
functionArgSeparatorandmatrixColumnSeparatorboth as;?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
parser will handle this
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
as in: parser already handles well the conflict those have over ',' symbol
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍