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

Failed to parse expression: "$((16#ffff))" decimal conversion #138

Closed
fakuivan opened this issue Jul 19, 2019 · 3 comments
Closed

Failed to parse expression: "$((16#ffff))" decimal conversion #138

fakuivan opened this issue Jul 19, 2019 · 3 comments
Labels
grammar bug Issues related to the bash grammar question Further information is requested

Comments

@fakuivan
Copy link

#!/usr/bin/env bash
function to_decimal () {
    echo "$(("$1"#"$2"))"
}
to_decimal 16 ff

The function to_decimal converts the number "$2" in base "$1" to decimal. The parser fails to recognize this instruction.

@skovhus
Copy link
Collaborator

skovhus commented Sep 23, 2019

Thanks for reporting this issue. It seems to be a grammar issue.

I create an issue: tree-sitter/tree-sitter-bash#62

@skovhus skovhus added the grammar bug Issues related to the bash grammar label Sep 23, 2019
@skovhus
Copy link
Collaborator

skovhus commented Mar 4, 2020

In my version of bash I actually get an error here:

"line 3: "16"#"ff": syntax error: operand expected (error token is ""16"#"ff"")"
$ bash --version
GNU bash, version 3.2.57(1)-release (x86_64-apple-darwin18)
Copyright (C) 2007 Free Software Foundation, Inc.

@skovhus skovhus added the question Further information is requested label Mar 4, 2020
@skovhus
Copy link
Collaborator

skovhus commented Nov 25, 2022

This seems to have been fixed in the newer version of the grammar

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
grammar bug Issues related to the bash grammar question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants