uyha / tree-sitter-cmake

A Tree-sitter parser for CMake
MIT License
41 stars 9 forks source link

if condition error #8

Closed Decodetalkers closed 2 years ago

Decodetalkers commented 2 years ago
else(NOT (CMAKE_BUILD_TYPE OR CMAKE_CONFIGURATION_TYPES))

such command will reported error

for example

if(NOT (CMAKE_BUILD_TYPE OR CMAKE_CONFIGURATION_TYPES))
    set(CMAKE_BUILD_TYPE "Debug" CACHE STRING
        "Choose the type of build, options are: None Debug Release RelWithDebInfo MinSizeRel."
        FORCE)
    message("Setting build type to '${CMAKE_BUILD_TYPE}'")
else(NOT (CMAKE_BUILD_TYPE OR CMAKE_CONFIGURATION_TYPES))
    message("Build type set to '${CMAKE_BUILD_TYPE}'")
endif(NOT (CMAKE_BUILD_TYPE OR CMAKE_CONFIGURATION_TYPES))
uyha commented 2 years ago

What is the error?

Decodetalkers commented 2 years ago

What is the error?

Like this one

if(NOT (CMAKE_BUILD_TYPE OR CMAKE_CONFIGURATION_TYPES))
    set(CMAKE_BUILD_TYPE "Debug" CACHE STRING
        "Choose the type of build, options are: None Debug Release RelWithDebInfo MinSizeRel."
        FORCE)
    message("Setting build type to '${CMAKE_BUILD_TYPE}'")
else(NOT (CMAKE_BUILD_TYPE OR CMAKE_CONFIGURATION_TYPES))
    message("Build type set to '${CMAKE_BUILD_TYPE}'")
endif(NOT (CMAKE_BUILD_TYPE OR CMAKE_CONFIGURATION_TYPES))

output is

(source_file [0, 0] - [8, 0]
  (if_condition [0, 0] - [7, 57]
    (if_command [0, 0] - [0, 55]
      (if [0, 0] - [0, 2])
      (argument [0, 3] - [0, 6]
        (unquoted_argument [0, 3] - [0, 6]))
      (argument [0, 8] - [0, 24]
        (unquoted_argument [0, 8] - [0, 24]))
      (argument [0, 25] - [0, 27]
        (unquoted_argument [0, 25] - [0, 27]))
      (argument [0, 28] - [0, 53]
        (unquoted_argument [0, 28] - [0, 53])))
    (normal_command [1, 1] - [3, 8]
      (identifier [1, 1] - [1, 4])
      (argument [1, 5] - [1, 21]
        (unquoted_argument [1, 5] - [1, 21]))
      (argument [1, 22] - [1, 29]
        (quoted_argument [1, 22] - [1, 29]
          (quoted_element [1, 23] - [1, 28])))
      (argument [1, 30] - [1, 35]
        (unquoted_argument [1, 30] - [1, 35]))
      (argument [1, 36] - [1, 42]
        (unquoted_argument [1, 36] - [1, 42]))
      (argument [2, 2] - [2, 88]
        (quoted_argument [2, 2] - [2, 88]
          (quoted_element [2, 3] - [2, 87])))
      (argument [3, 2] - [3, 7]
        (unquoted_argument [3, 2] - [3, 7])))
    (normal_command [4, 1] - [4, 55]
      (identifier [4, 1] - [4, 8])
      (argument [4, 9] - [4, 54]
        (quoted_argument [4, 9] - [4, 54]
          (quoted_element [4, 10] - [4, 53]
            (variable_ref [4, 33] - [4, 52]
              (normal_var [4, 33] - [4, 52]
                (variable [4, 35] - [4, 51])))))))
    (else_command [5, 0] - [5, 56]
      (else [5, 0] - [5, 4])
      (ERROR [5, 5] - [5, 10]
        (argument [5, 5] - [5, 9]
          (unquoted_argument [5, 5] - [5, 9])))
      (argument [5, 10] - [5, 55]
        (unquoted_argument [5, 10] - [5, 55])))
    (ERROR [5, 56] - [5, 57])
    (normal_command [6, 1] - [6, 51]
      (identifier [6, 1] - [6, 8])
      (argument [6, 9] - [6, 50]
        (quoted_argument [6, 9] - [6, 50]
          (quoted_element [6, 10] - [6, 49]
            (variable_ref [6, 29] - [6, 48]
              (normal_var [6, 29] - [6, 48]
                (variable [6, 31] - [6, 47])))))))
    (endif_command [7, 0] - [7, 57]
      (endif [7, 0] - [7, 5])
      (ERROR [7, 6] - [7, 11]
        (argument [7, 6] - [7, 10]
          (unquoted_argument [7, 6] - [7, 10])))
      (argument [7, 11] - [7, 56]
        (unquoted_argument [7, 11] - [7, 56]))))
  (ERROR [7, 57] - [7, 58]))
CMakeLists.txt  0 ms    (ERROR [5, 5] - [5, 10])
uyha commented 2 years ago

Fix with 3d23db47a515852f79bbb7a1c4e61a8cc97ae5d3

Decodetalkers commented 2 years ago

Fix with 3d23db4

and you'd better change the line in Cargo.toml to your url

repository = "https://github.com/tree-sitter/tree-sitter-cmake"

uyha commented 2 years ago

done also

Decodetalkers commented 2 years ago

and update the version in Cargo.toml,to version0.0.3 I think

uyha commented 2 years ago

I'm not doing versioning for now

Decodetalkers commented 2 years ago

I'm not doing versioning for now

Right, But I will update the version to crate. with 0.0.3..

uyha commented 2 years ago

yeah, ok, i'll start doing versioning then

Decodetalkers commented 2 years ago

Thanks a lot

Decodetalkers commented 2 years ago

and I think https://crates.io/crates/tree-sitter-cmake/0.0.3 It should be your crate, I think you should also be the owner..

uyha commented 2 years ago

I’m not using Rust often so I’m not gonna maintain it, I don’t have a use case for it myself also.