Skip to content
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

Added Sequence Operations, selector and test cases #23

Merged
merged 5 commits into from
Jul 14, 2024

Conversation

Vishalk91-4
Copy link
Contributor

@Vishalk91-4 Vishalk91-4 commented Jul 2, 2024

1. Does this PR affect any open issues?(Y/N) and add issue references (e.g. "fix #123", "re #123".):

  • N
  • Y
re #2

2. What is the scope of this PR (e.g. component or file name):

  • grammar.js
  • expr.txt
  • assign.txt
  • schema.txt
  • grammar.json
  • parser.c

3. Provide a description of the PR(e.g. more details, effects, motivations or doc link):

  • Affects user behaviors
  • Contains syntax changes
  • Contains variable changes
  • Contains experimental features
  • Performance regression: Consumes more CPU
  • Performance regression: Consumes more Memory
  • Other
  • Adding sequence operations
  • Adding selectors
  • Adding select_suffix syntax
  • Adding Test Cases for selector expression and sequence operations

4. Are there any breaking changes?(Y/N) and describe the breaking changes(e.g. more details, motivations or doc link):

  • N
  • Y

5. Are there test cases for these changes?(Y/N) select and add more details, references or doc links:

  • Unit test
  • Integration test
  • Benchmark (add benchmark stats below)
  • Manual test (add detailed scripts or steps below)
  • Other

grammar.js Outdated Show resolved Hide resolved
@Vishalk91-4 Vishalk91-4 marked this pull request as ready for review July 13, 2024 10:11
@Peefy Peefy changed the title [WIP] Added Sequence Operations, selector and test cases Added Sequence Operations, selector and test cases Jul 13, 2024
grammar.js Outdated

in_operation: $ => prec.left(3, seq(choice($.list_comprehension, $.dictionary_comprehension, $.list, $.dictionary), 'in', choice($.list_comprehension, $.dictionary_comprehension, $.list, $.dictionary))),
not_in_operation: $ => prec.left(11, seq(choice($.list_comprehension, $.dictionary_comprehension, $.list, $.dictionary), 'not', 'in', $.expression)),
concatenation: $ => prec.left(12, seq(choice($.list_comprehension, $.dictionary_comprehension, $.list, $.dictionary), '+', $.expression)),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Put x + y into the binary expression grammar and consider x - y, x * y, and x ** y, etc, as well as their priorities.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In Binary expression I found that it already has x+y, x-y, x*y, x**y
So, Do you want me to add binary_operator inside sequence_operation inplace of concatenation to cover it all

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, you can remove concatenation here.

Copy link
Contributor

@Peefy Peefy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@Peefy Peefy merged commit e225df4 into kcl-lang:main Jul 14, 2024
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants