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

Allow unquoted values in val_record #136

Merged
merged 1 commit into from
Nov 8, 2024
Merged

Allow unquoted values in val_record #136

merged 1 commit into from
Nov 8, 2024

Conversation

blindFS
Copy link
Contributor

@blindFS blindFS commented Nov 8, 2024

This PR fixes situations where record value is an unquoted string

image

Also cleaned list_entry rule a little bit since signed numbers, flags and unquoted string start with +/- are more easy to distinguish.

@blindFS
Copy link
Contributor Author

blindFS commented Nov 8, 2024

BTW, I don't know whether this is desired:

image

But it makes unquoted strings easier to parse and current grammar works in the same way.
If so, _expr_unary_minus doesn't make much sense then.

@fdncred
Copy link
Collaborator

fdncred commented Nov 8, 2024

Is you screenshot the "before" or "after" this PR?

x is supposed to be a string here

 {k: a}
╭───┬───╮
 k  a 
╰───┴───╯
 {k: a} | describe -d | table -e
╭─────────┬────────────────╮
 type     record         
          ╭───┬────────╮ 
 columns   k  string  
          ╰───┴────────╯ 
╰─────────┴────────────────╯

@blindFS
Copy link
Contributor Author

blindFS commented Nov 8, 2024

@fdncred
The screenshot with error is before this PR, should be fine after this.

(nu_script [0, 0] - [3, 0]
  (pipeline [0, 0] - [3, 0]
    (pipe_element [0, 0] - [2, 1]
      (val_record [0, 0] - [2, 1]
        (record_body [1, 2] - [2, 0]
          entry: (record_entry [1, 2] - [1, 8]
            key: (identifier [1, 2] - [1, 3])
            value: (val_string [1, 5] - [1, 8])))))))

@blindFS
Copy link
Contributor Author

blindFS commented Nov 8, 2024

_expr_unary_minus however is left as it was, which is not exactly current nushell's behaviour. It's not related to $.val_record, just some random stuff found during the code cleansing.

@fdncred fdncred merged commit caf8baf into nushell:main Nov 8, 2024
3 checks passed
@fdncred
Copy link
Collaborator

fdncred commented Nov 8, 2024

Thanks

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