joshtemple / lkml

A speedy LookML parser & serializer implemented in pure Python.
MIT License
166 stars 31 forks source link

Whitespace sensitive parsing issue #59

Closed hsheth2 closed 2 years ago

hsheth2 commented 3 years ago

If there is a space after "CLOSED", lkml throws an error: SyntaxError: Unable to find a matching expression for '<whitespace>' on line 15

connection: "my_connection"

explore: second_model {
  label: "Second model!"
  description: "Lorem ipsum"

  measure: bookings_measure {
    label: "Number of new bookings"
    group_label: "New bookings"
    description: "A distinct count of all new bookings"
    sql: ${booking_id} ;;
    type: count_distinct
    filters: [ state: "CLOSED" ,
      name: "New Bookings"]
  }
}

Removing the space between the "CLOSED" and the comma works.

Full debug logs below:

❯ lkml -v second.model.lkml
lkml.parser DEBUG: Check StreamStartToken() == StreamStartToken
lkml.parser DEBUG: Check LiteralToken(connection) == CommentToken or WhitespaceToken
lkml.parser DEBUG: Try to parse [expression] = (block / pair / list)*
lkml.parser DEBUG: . Check LiteralToken(connection) == CommentToken or WhitespaceToken
lkml.parser DEBUG: . Check LiteralToken(connection) == StreamEndToken or BlockEndToken
lkml.parser DEBUG: . Try to parse [block] = key literal? '{' expression '}'
lkml.parser DEBUG: . . Try to parse [key] = literal ':'
lkml.parser DEBUG: . . . Check LiteralToken(connection) == CommentToken or WhitespaceToken
lkml.parser DEBUG: . . . Check LiteralToken(connection) == LiteralToken
lkml.parser DEBUG: . . . Check ValueToken() == CommentToken or WhitespaceToken
lkml.parser DEBUG: . . . Check ValueToken() == ValueToken
lkml.parser DEBUG: . . . Check WhitespaceToken(' ') == CommentToken or WhitespaceToken
lkml.parser DEBUG: . . . Check QuotedLiteralToken(my_connection) == CommentToken or WhitespaceToken
lkml.parser DEBUG: . . Successfully parsed key.
lkml.parser DEBUG: . . Check QuotedLiteralToken(my_connection) == LiteralToken
lkml.parser DEBUG: . . Check QuotedLiteralToken(my_connection) == CommentToken or WhitespaceToken
lkml.parser DEBUG: . . Check QuotedLiteralToken(my_connection) == BlockStartToken
lkml.parser DEBUG: . Try to parse [pair] = key value
lkml.parser DEBUG: . . Try to parse [key] = literal ':'
lkml.parser DEBUG: . . . Check LiteralToken(connection) == CommentToken or WhitespaceToken
lkml.parser DEBUG: . . . Check LiteralToken(connection) == LiteralToken
lkml.parser DEBUG: . . . Check ValueToken() == CommentToken or WhitespaceToken
lkml.parser DEBUG: . . . Check ValueToken() == ValueToken
lkml.parser DEBUG: . . . Check WhitespaceToken(' ') == CommentToken or WhitespaceToken
lkml.parser DEBUG: . . . Check QuotedLiteralToken(my_connection) == CommentToken or WhitespaceToken
lkml.parser DEBUG: . . Successfully parsed key.
lkml.parser DEBUG: . . Try to parse [value] = literal / quoted_literal / expression_block
lkml.parser DEBUG: . . . Check QuotedLiteralToken(my_connection) == LiteralToken
lkml.parser DEBUG: . . . Check QuotedLiteralToken(my_connection) == QuotedLiteralToken
lkml.parser DEBUG: . . Successfully parsed value.
lkml.parser DEBUG: . Successfully parsed pair.
lkml.parser DEBUG: . Check WhitespaceToken('\n\n') == CommentToken or WhitespaceToken
lkml.parser DEBUG: . Check LiteralToken(include) == CommentToken or WhitespaceToken
lkml.parser DEBUG: . Check LiteralToken(include) == StreamEndToken or BlockEndToken
lkml.parser DEBUG: . Try to parse [block] = key literal? '{' expression '}'
lkml.parser DEBUG: . . Try to parse [key] = literal ':'
lkml.parser DEBUG: . . . Check WhitespaceToken('\n\n') == CommentToken or WhitespaceToken
lkml.parser DEBUG: . . . Check LiteralToken(include) == CommentToken or WhitespaceToken
lkml.parser DEBUG: . . . Check LiteralToken(include) == LiteralToken
lkml.parser DEBUG: . . . Check ValueToken() == CommentToken or WhitespaceToken
lkml.parser DEBUG: . . . Check ValueToken() == ValueToken
lkml.parser DEBUG: . . . Check WhitespaceToken(' ') == CommentToken or WhitespaceToken
lkml.parser DEBUG: . . . Check QuotedLiteralToken(/view_declarations.view) == CommentToken or WhitespaceToken
lkml.parser DEBUG: . . Successfully parsed key.
lkml.parser DEBUG: . . Check QuotedLiteralToken(/view_declarations.view) == LiteralToken
lkml.parser DEBUG: . . Check QuotedLiteralToken(/view_declarations.view) == CommentToken or WhitespaceToken
lkml.parser DEBUG: . . Check QuotedLiteralToken(/view_declarations.view) == BlockStartToken
lkml.parser DEBUG: . Try to parse [pair] = key value
lkml.parser DEBUG: . . Try to parse [key] = literal ':'
lkml.parser DEBUG: . . . Check WhitespaceToken('\n\n') == CommentToken or WhitespaceToken
lkml.parser DEBUG: . . . Check LiteralToken(include) == CommentToken or WhitespaceToken
lkml.parser DEBUG: . . . Check LiteralToken(include) == LiteralToken
lkml.parser DEBUG: . . . Check ValueToken() == CommentToken or WhitespaceToken
lkml.parser DEBUG: . . . Check ValueToken() == ValueToken
lkml.parser DEBUG: . . . Check WhitespaceToken(' ') == CommentToken or WhitespaceToken
lkml.parser DEBUG: . . . Check QuotedLiteralToken(/view_declarations.view) == CommentToken or WhitespaceToken
lkml.parser DEBUG: . . Successfully parsed key.
lkml.parser DEBUG: . . Try to parse [value] = literal / quoted_literal / expression_block
lkml.parser DEBUG: . . . Check QuotedLiteralToken(/view_declarations.view) == LiteralToken
lkml.parser DEBUG: . . . Check QuotedLiteralToken(/view_declarations.view) == QuotedLiteralToken
lkml.parser DEBUG: . . Successfully parsed value.
lkml.parser DEBUG: . Successfully parsed pair.
lkml.parser DEBUG: . Check WhitespaceToken('\n\n') == CommentToken or WhitespaceToken
lkml.parser DEBUG: . Check LiteralToken(explore) == CommentToken or WhitespaceToken
lkml.parser DEBUG: . Check LiteralToken(explore) == StreamEndToken or BlockEndToken
lkml.parser DEBUG: . Try to parse [block] = key literal? '{' expression '}'
lkml.parser DEBUG: . . Try to parse [key] = literal ':'
lkml.parser DEBUG: . . . Check WhitespaceToken('\n\n') == CommentToken or WhitespaceToken
lkml.parser DEBUG: . . . Check LiteralToken(explore) == CommentToken or WhitespaceToken
lkml.parser DEBUG: . . . Check LiteralToken(explore) == LiteralToken
lkml.parser DEBUG: . . . Check ValueToken() == CommentToken or WhitespaceToken
lkml.parser DEBUG: . . . Check ValueToken() == ValueToken
lkml.parser DEBUG: . . . Check WhitespaceToken(' ') == CommentToken or WhitespaceToken
lkml.parser DEBUG: . . . Check LiteralToken(second_model) == CommentToken or WhitespaceToken
lkml.parser DEBUG: . . Successfully parsed key.
lkml.parser DEBUG: . . Check LiteralToken(second_model) == LiteralToken
lkml.parser DEBUG: . . Check WhitespaceToken(' ') == CommentToken or WhitespaceToken
lkml.parser DEBUG: . . Check BlockStartToken() == CommentToken or WhitespaceToken
lkml.parser DEBUG: . . Check BlockStartToken() == BlockStartToken
lkml.parser DEBUG: . . Check WhitespaceToken('\n  ') == CommentToken or WhitespaceToken
lkml.parser DEBUG: . . Check LiteralToken(label) == CommentToken or WhitespaceToken
lkml.parser DEBUG: . . Try to parse [expression] = (block / pair / list)*
lkml.parser DEBUG: . . . Check LiteralToken(label) == CommentToken or WhitespaceToken
lkml.parser DEBUG: . . . Check LiteralToken(label) == StreamEndToken or BlockEndToken
lkml.parser DEBUG: . . . Try to parse [block] = key literal? '{' expression '}'
lkml.parser DEBUG: . . . . Try to parse [key] = literal ':'
lkml.parser DEBUG: . . . . . Check LiteralToken(label) == CommentToken or WhitespaceToken
lkml.parser DEBUG: . . . . . Check LiteralToken(label) == LiteralToken
lkml.parser DEBUG: . . . . . Check ValueToken() == CommentToken or WhitespaceToken
lkml.parser DEBUG: . . . . . Check ValueToken() == ValueToken
lkml.parser DEBUG: . . . . . Check WhitespaceToken(' ') == CommentToken or WhitespaceToken
lkml.parser DEBUG: . . . . . Check QuotedLiteralToken(Second model!) == CommentToken or WhitespaceToken
lkml.parser DEBUG: . . . . Successfully parsed key.
lkml.parser DEBUG: . . . . Check QuotedLiteralToken(Second model!) == LiteralToken
lkml.parser DEBUG: . . . . Check QuotedLiteralToken(Second model!) == CommentToken or WhitespaceToken
lkml.parser DEBUG: . . . . Check QuotedLiteralToken(Second model!) == BlockStartToken
lkml.parser DEBUG: . . . Try to parse [pair] = key value
lkml.parser DEBUG: . . . . Try to parse [key] = literal ':'
lkml.parser DEBUG: . . . . . Check LiteralToken(label) == CommentToken or WhitespaceToken
lkml.parser DEBUG: . . . . . Check LiteralToken(label) == LiteralToken
lkml.parser DEBUG: . . . . . Check ValueToken() == CommentToken or WhitespaceToken
lkml.parser DEBUG: . . . . . Check ValueToken() == ValueToken
lkml.parser DEBUG: . . . . . Check WhitespaceToken(' ') == CommentToken or WhitespaceToken
lkml.parser DEBUG: . . . . . Check QuotedLiteralToken(Second model!) == CommentToken or WhitespaceToken
lkml.parser DEBUG: . . . . Successfully parsed key.
lkml.parser DEBUG: . . . . Try to parse [value] = literal / quoted_literal / expression_block
lkml.parser DEBUG: . . . . . Check QuotedLiteralToken(Second model!) == LiteralToken
lkml.parser DEBUG: . . . . . Check QuotedLiteralToken(Second model!) == QuotedLiteralToken
lkml.parser DEBUG: . . . . Successfully parsed value.
lkml.parser DEBUG: . . . Successfully parsed pair.
lkml.parser DEBUG: . . . Check WhitespaceToken('\n  ') == CommentToken or WhitespaceToken
lkml.parser DEBUG: . . . Check LiteralToken(description) == CommentToken or WhitespaceToken
lkml.parser DEBUG: . . . Check LiteralToken(description) == StreamEndToken or BlockEndToken
lkml.parser DEBUG: . . . Try to parse [block] = key literal? '{' expression '}'
lkml.parser DEBUG: . . . . Try to parse [key] = literal ':'
lkml.parser DEBUG: . . . . . Check WhitespaceToken('\n  ') == CommentToken or WhitespaceToken
lkml.parser DEBUG: . . . . . Check LiteralToken(description) == CommentToken or WhitespaceToken
lkml.parser DEBUG: . . . . . Check LiteralToken(description) == LiteralToken
lkml.parser DEBUG: . . . . . Check ValueToken() == CommentToken or WhitespaceToken
lkml.parser DEBUG: . . . . . Check ValueToken() == ValueToken
lkml.parser DEBUG: . . . . . Check WhitespaceToken(' ') == CommentToken or WhitespaceToken
lkml.parser DEBUG: . . . . . Check QuotedLiteralToken(Lorem ipsum) == CommentToken or WhitespaceToken
lkml.parser DEBUG: . . . . Successfully parsed key.
lkml.parser DEBUG: . . . . Check QuotedLiteralToken(Lorem ipsum) == LiteralToken
lkml.parser DEBUG: . . . . Check QuotedLiteralToken(Lorem ipsum) == CommentToken or WhitespaceToken
lkml.parser DEBUG: . . . . Check QuotedLiteralToken(Lorem ipsum) == BlockStartToken
lkml.parser DEBUG: . . . Try to parse [pair] = key value
lkml.parser DEBUG: . . . . Try to parse [key] = literal ':'
lkml.parser DEBUG: . . . . . Check WhitespaceToken('\n  ') == CommentToken or WhitespaceToken
lkml.parser DEBUG: . . . . . Check LiteralToken(description) == CommentToken or WhitespaceToken
lkml.parser DEBUG: . . . . . Check LiteralToken(description) == LiteralToken
lkml.parser DEBUG: . . . . . Check ValueToken() == CommentToken or WhitespaceToken
lkml.parser DEBUG: . . . . . Check ValueToken() == ValueToken
lkml.parser DEBUG: . . . . . Check WhitespaceToken(' ') == CommentToken or WhitespaceToken
lkml.parser DEBUG: . . . . . Check QuotedLiteralToken(Lorem ipsum) == CommentToken or WhitespaceToken
lkml.parser DEBUG: . . . . Successfully parsed key.
lkml.parser DEBUG: . . . . Try to parse [value] = literal / quoted_literal / expression_block
lkml.parser DEBUG: . . . . . Check QuotedLiteralToken(Lorem ipsum) == LiteralToken
lkml.parser DEBUG: . . . . . Check QuotedLiteralToken(Lorem ipsum) == QuotedLiteralToken
lkml.parser DEBUG: . . . . Successfully parsed value.
lkml.parser DEBUG: . . . Successfully parsed pair.
lkml.parser DEBUG: . . . Check WhitespaceToken('\n\n  ') == CommentToken or WhitespaceToken
lkml.parser DEBUG: . . . Check LiteralToken(measure) == CommentToken or WhitespaceToken
lkml.parser DEBUG: . . . Check LiteralToken(measure) == StreamEndToken or BlockEndToken
lkml.parser DEBUG: . . . Try to parse [block] = key literal? '{' expression '}'
lkml.parser DEBUG: . . . . Try to parse [key] = literal ':'
lkml.parser DEBUG: . . . . . Check WhitespaceToken('\n\n  ') == CommentToken or WhitespaceToken
lkml.parser DEBUG: . . . . . Check LiteralToken(measure) == CommentToken or WhitespaceToken
lkml.parser DEBUG: . . . . . Check LiteralToken(measure) == LiteralToken
lkml.parser DEBUG: . . . . . Check ValueToken() == CommentToken or WhitespaceToken
lkml.parser DEBUG: . . . . . Check ValueToken() == ValueToken
lkml.parser DEBUG: . . . . . Check WhitespaceToken(' ') == CommentToken or WhitespaceToken
lkml.parser DEBUG: . . . . . Check LiteralToken(bookings_measure) == CommentToken or WhitespaceToken
lkml.parser DEBUG: . . . . Successfully parsed key.
lkml.parser DEBUG: . . . . Check LiteralToken(bookings_measure) == LiteralToken
lkml.parser DEBUG: . . . . Check WhitespaceToken(' ') == CommentToken or WhitespaceToken
lkml.parser DEBUG: . . . . Check BlockStartToken() == CommentToken or WhitespaceToken
lkml.parser DEBUG: . . . . Check BlockStartToken() == BlockStartToken
lkml.parser DEBUG: . . . . Check WhitespaceToken('\n    ') == CommentToken or WhitespaceToken
lkml.parser DEBUG: . . . . Check LiteralToken(label) == CommentToken or WhitespaceToken
lkml.parser DEBUG: . . . . Try to parse [expression] = (block / pair / list)*
lkml.parser DEBUG: . . . . . Check LiteralToken(label) == CommentToken or WhitespaceToken
lkml.parser DEBUG: . . . . . Check LiteralToken(label) == StreamEndToken or BlockEndToken
lkml.parser DEBUG: . . . . . Try to parse [block] = key literal? '{' expression '}'
lkml.parser DEBUG: . . . . . . Try to parse [key] = literal ':'
lkml.parser DEBUG: . . . . . . . Check LiteralToken(label) == CommentToken or WhitespaceToken
lkml.parser DEBUG: . . . . . . . Check LiteralToken(label) == LiteralToken
lkml.parser DEBUG: . . . . . . . Check ValueToken() == CommentToken or WhitespaceToken
lkml.parser DEBUG: . . . . . . . Check ValueToken() == ValueToken
lkml.parser DEBUG: . . . . . . . Check WhitespaceToken(' ') == CommentToken or WhitespaceToken
lkml.parser DEBUG: . . . . . . . Check QuotedLiteralToken(Number of new bookings) == CommentToken or WhitespaceToken
lkml.parser DEBUG: . . . . . . Successfully parsed key.
lkml.parser DEBUG: . . . . . . Check QuotedLiteralToken(Number of new bookings) == LiteralToken
lkml.parser DEBUG: . . . . . . Check QuotedLiteralToken(Number of new bookings) == CommentToken or WhitespaceToken
lkml.parser DEBUG: . . . . . . Check QuotedLiteralToken(Number of new bookings) == BlockStartToken
lkml.parser DEBUG: . . . . . Try to parse [pair] = key value
lkml.parser DEBUG: . . . . . . Try to parse [key] = literal ':'
lkml.parser DEBUG: . . . . . . . Check LiteralToken(label) == CommentToken or WhitespaceToken
lkml.parser DEBUG: . . . . . . . Check LiteralToken(label) == LiteralToken
lkml.parser DEBUG: . . . . . . . Check ValueToken() == CommentToken or WhitespaceToken
lkml.parser DEBUG: . . . . . . . Check ValueToken() == ValueToken
lkml.parser DEBUG: . . . . . . . Check WhitespaceToken(' ') == CommentToken or WhitespaceToken
lkml.parser DEBUG: . . . . . . . Check QuotedLiteralToken(Number of new bookings) == CommentToken or WhitespaceToken
lkml.parser DEBUG: . . . . . . Successfully parsed key.
lkml.parser DEBUG: . . . . . . Try to parse [value] = literal / quoted_literal / expression_block
lkml.parser DEBUG: . . . . . . . Check QuotedLiteralToken(Number of new bookings) == LiteralToken
lkml.parser DEBUG: . . . . . . . Check QuotedLiteralToken(Number of new bookings) == QuotedLiteralToken
lkml.parser DEBUG: . . . . . . Successfully parsed value.
lkml.parser DEBUG: . . . . . Successfully parsed pair.
lkml.parser DEBUG: . . . . . Check WhitespaceToken('\n    ') == CommentToken or WhitespaceToken
lkml.parser DEBUG: . . . . . Check LiteralToken(group_label) == CommentToken or WhitespaceToken
lkml.parser DEBUG: . . . . . Check LiteralToken(group_label) == StreamEndToken or BlockEndToken
lkml.parser DEBUG: . . . . . Try to parse [block] = key literal? '{' expression '}'
lkml.parser DEBUG: . . . . . . Try to parse [key] = literal ':'
lkml.parser DEBUG: . . . . . . . Check WhitespaceToken('\n    ') == CommentToken or WhitespaceToken
lkml.parser DEBUG: . . . . . . . Check LiteralToken(group_label) == CommentToken or WhitespaceToken
lkml.parser DEBUG: . . . . . . . Check LiteralToken(group_label) == LiteralToken
lkml.parser DEBUG: . . . . . . . Check ValueToken() == CommentToken or WhitespaceToken
lkml.parser DEBUG: . . . . . . . Check ValueToken() == ValueToken
lkml.parser DEBUG: . . . . . . . Check WhitespaceToken(' ') == CommentToken or WhitespaceToken
lkml.parser DEBUG: . . . . . . . Check QuotedLiteralToken(New bookings) == CommentToken or WhitespaceToken
lkml.parser DEBUG: . . . . . . Successfully parsed key.
lkml.parser DEBUG: . . . . . . Check QuotedLiteralToken(New bookings) == LiteralToken
lkml.parser DEBUG: . . . . . . Check QuotedLiteralToken(New bookings) == CommentToken or WhitespaceToken
lkml.parser DEBUG: . . . . . . Check QuotedLiteralToken(New bookings) == BlockStartToken
lkml.parser DEBUG: . . . . . Try to parse [pair] = key value
lkml.parser DEBUG: . . . . . . Try to parse [key] = literal ':'
lkml.parser DEBUG: . . . . . . . Check WhitespaceToken('\n    ') == CommentToken or WhitespaceToken
lkml.parser DEBUG: . . . . . . . Check LiteralToken(group_label) == CommentToken or WhitespaceToken
lkml.parser DEBUG: . . . . . . . Check LiteralToken(group_label) == LiteralToken
lkml.parser DEBUG: . . . . . . . Check ValueToken() == CommentToken or WhitespaceToken
lkml.parser DEBUG: . . . . . . . Check ValueToken() == ValueToken
lkml.parser DEBUG: . . . . . . . Check WhitespaceToken(' ') == CommentToken or WhitespaceToken
lkml.parser DEBUG: . . . . . . . Check QuotedLiteralToken(New bookings) == CommentToken or WhitespaceToken
lkml.parser DEBUG: . . . . . . Successfully parsed key.
lkml.parser DEBUG: . . . . . . Try to parse [value] = literal / quoted_literal / expression_block
lkml.parser DEBUG: . . . . . . . Check QuotedLiteralToken(New bookings) == LiteralToken
lkml.parser DEBUG: . . . . . . . Check QuotedLiteralToken(New bookings) == QuotedLiteralToken
lkml.parser DEBUG: . . . . . . Successfully parsed value.
lkml.parser DEBUG: . . . . . Successfully parsed pair.
lkml.parser DEBUG: . . . . . Check WhitespaceToken('\n    ') == CommentToken or WhitespaceToken
lkml.parser DEBUG: . . . . . Check LiteralToken(description) == CommentToken or WhitespaceToken
lkml.parser DEBUG: . . . . . Check LiteralToken(description) == StreamEndToken or BlockEndToken
lkml.parser DEBUG: . . . . . Try to parse [block] = key literal? '{' expression '}'
lkml.parser DEBUG: . . . . . . Try to parse [key] = literal ':'
lkml.parser DEBUG: . . . . . . . Check WhitespaceToken('\n    ') == CommentToken or WhitespaceToken
lkml.parser DEBUG: . . . . . . . Check LiteralToken(description) == CommentToken or WhitespaceToken
lkml.parser DEBUG: . . . . . . . Check LiteralToken(description) == LiteralToken
lkml.parser DEBUG: . . . . . . . Check ValueToken() == CommentToken or WhitespaceToken
lkml.parser DEBUG: . . . . . . . Check ValueToken() == ValueToken
lkml.parser DEBUG: . . . . . . . Check WhitespaceToken(' ') == CommentToken or WhitespaceToken
lkml.parser DEBUG: . . . . . . . Check QuotedLiteralToken(A distinct count of all n ... ) == CommentToken or WhitespaceToken
lkml.parser DEBUG: . . . . . . Successfully parsed key.
lkml.parser DEBUG: . . . . . . Check QuotedLiteralToken(A distinct count of all n ... ) == LiteralToken
lkml.parser DEBUG: . . . . . . Check QuotedLiteralToken(A distinct count of all n ... ) == CommentToken or WhitespaceToken
lkml.parser DEBUG: . . . . . . Check QuotedLiteralToken(A distinct count of all n ... ) == BlockStartToken
lkml.parser DEBUG: . . . . . Try to parse [pair] = key value
lkml.parser DEBUG: . . . . . . Try to parse [key] = literal ':'
lkml.parser DEBUG: . . . . . . . Check WhitespaceToken('\n    ') == CommentToken or WhitespaceToken
lkml.parser DEBUG: . . . . . . . Check LiteralToken(description) == CommentToken or WhitespaceToken
lkml.parser DEBUG: . . . . . . . Check LiteralToken(description) == LiteralToken
lkml.parser DEBUG: . . . . . . . Check ValueToken() == CommentToken or WhitespaceToken
lkml.parser DEBUG: . . . . . . . Check ValueToken() == ValueToken
lkml.parser DEBUG: . . . . . . . Check WhitespaceToken(' ') == CommentToken or WhitespaceToken
lkml.parser DEBUG: . . . . . . . Check QuotedLiteralToken(A distinct count of all n ... ) == CommentToken or WhitespaceToken
lkml.parser DEBUG: . . . . . . Successfully parsed key.
lkml.parser DEBUG: . . . . . . Try to parse [value] = literal / quoted_literal / expression_block
lkml.parser DEBUG: . . . . . . . Check QuotedLiteralToken(A distinct count of all n ... ) == LiteralToken
lkml.parser DEBUG: . . . . . . . Check QuotedLiteralToken(A distinct count of all n ... ) == QuotedLiteralToken
lkml.parser DEBUG: . . . . . . Successfully parsed value.
lkml.parser DEBUG: . . . . . Successfully parsed pair.
lkml.parser DEBUG: . . . . . Check WhitespaceToken('\n    ') == CommentToken or WhitespaceToken
lkml.parser DEBUG: . . . . . Check LiteralToken(sql) == CommentToken or WhitespaceToken
lkml.parser DEBUG: . . . . . Check LiteralToken(sql) == StreamEndToken or BlockEndToken
lkml.parser DEBUG: . . . . . Try to parse [block] = key literal? '{' expression '}'
lkml.parser DEBUG: . . . . . . Try to parse [key] = literal ':'
lkml.parser DEBUG: . . . . . . . Check WhitespaceToken('\n    ') == CommentToken or WhitespaceToken
lkml.parser DEBUG: . . . . . . . Check LiteralToken(sql) == CommentToken or WhitespaceToken
lkml.parser DEBUG: . . . . . . . Check LiteralToken(sql) == LiteralToken
lkml.parser DEBUG: . . . . . . . Check ValueToken() == CommentToken or WhitespaceToken
lkml.parser DEBUG: . . . . . . . Check ValueToken() == ValueToken
lkml.parser DEBUG: . . . . . . . Check ExpressionBlockToken(${booking_id}) == CommentToken or WhitespaceToken
lkml.parser DEBUG: . . . . . . Successfully parsed key.
lkml.parser DEBUG: . . . . . . Check ExpressionBlockToken(${booking_id}) == LiteralToken
lkml.parser DEBUG: . . . . . . Check ExpressionBlockToken(${booking_id}) == CommentToken or WhitespaceToken
lkml.parser DEBUG: . . . . . . Check ExpressionBlockToken(${booking_id}) == BlockStartToken
lkml.parser DEBUG: . . . . . Try to parse [pair] = key value
lkml.parser DEBUG: . . . . . . Try to parse [key] = literal ':'
lkml.parser DEBUG: . . . . . . . Check WhitespaceToken('\n    ') == CommentToken or WhitespaceToken
lkml.parser DEBUG: . . . . . . . Check LiteralToken(sql) == CommentToken or WhitespaceToken
lkml.parser DEBUG: . . . . . . . Check LiteralToken(sql) == LiteralToken
lkml.parser DEBUG: . . . . . . . Check ValueToken() == CommentToken or WhitespaceToken
lkml.parser DEBUG: . . . . . . . Check ValueToken() == ValueToken
lkml.parser DEBUG: . . . . . . . Check ExpressionBlockToken(${booking_id}) == CommentToken or WhitespaceToken
lkml.parser DEBUG: . . . . . . Successfully parsed key.
lkml.parser DEBUG: . . . . . . Try to parse [value] = literal / quoted_literal / expression_block
lkml.parser DEBUG: . . . . . . . Check ExpressionBlockToken(${booking_id}) == LiteralToken
lkml.parser DEBUG: . . . . . . . Check ExpressionBlockToken(${booking_id}) == QuotedLiteralToken
lkml.parser DEBUG: . . . . . . . Check ExpressionBlockToken(${booking_id}) == ExpressionBlockToken
lkml.parser DEBUG: . . . . . . . Check ExpressionBlockEndToken() == ExpressionBlockEndToken
lkml.parser DEBUG: . . . . . . Successfully parsed value.
lkml.parser DEBUG: . . . . . Successfully parsed pair.
lkml.parser DEBUG: . . . . . Check WhitespaceToken('\n    ') == CommentToken or WhitespaceToken
lkml.parser DEBUG: . . . . . Check LiteralToken(type) == CommentToken or WhitespaceToken
lkml.parser DEBUG: . . . . . Check LiteralToken(type) == StreamEndToken or BlockEndToken
lkml.parser DEBUG: . . . . . Try to parse [block] = key literal? '{' expression '}'
lkml.parser DEBUG: . . . . . . Try to parse [key] = literal ':'
lkml.parser DEBUG: . . . . . . . Check WhitespaceToken('\n    ') == CommentToken or WhitespaceToken
lkml.parser DEBUG: . . . . . . . Check LiteralToken(type) == CommentToken or WhitespaceToken
lkml.parser DEBUG: . . . . . . . Check LiteralToken(type) == LiteralToken
lkml.parser DEBUG: . . . . . . . Check ValueToken() == CommentToken or WhitespaceToken
lkml.parser DEBUG: . . . . . . . Check ValueToken() == ValueToken
lkml.parser DEBUG: . . . . . . . Check WhitespaceToken(' ') == CommentToken or WhitespaceToken
lkml.parser DEBUG: . . . . . . . Check LiteralToken(count_distinct) == CommentToken or WhitespaceToken
lkml.parser DEBUG: . . . . . . Successfully parsed key.
lkml.parser DEBUG: . . . . . . Check LiteralToken(count_distinct) == LiteralToken
lkml.parser DEBUG: . . . . . . Check WhitespaceToken('\n    ') == CommentToken or WhitespaceToken
lkml.parser DEBUG: . . . . . . Check LiteralToken(filters) == CommentToken or WhitespaceToken
lkml.parser DEBUG: . . . . . . Check LiteralToken(filters) == BlockStartToken
lkml.parser DEBUG: . . . . . Try to parse [pair] = key value
lkml.parser DEBUG: . . . . . . Try to parse [key] = literal ':'
lkml.parser DEBUG: . . . . . . . Check WhitespaceToken('\n    ') == CommentToken or WhitespaceToken
lkml.parser DEBUG: . . . . . . . Check LiteralToken(type) == CommentToken or WhitespaceToken
lkml.parser DEBUG: . . . . . . . Check LiteralToken(type) == LiteralToken
lkml.parser DEBUG: . . . . . . . Check ValueToken() == CommentToken or WhitespaceToken
lkml.parser DEBUG: . . . . . . . Check ValueToken() == ValueToken
lkml.parser DEBUG: . . . . . . . Check WhitespaceToken(' ') == CommentToken or WhitespaceToken
lkml.parser DEBUG: . . . . . . . Check LiteralToken(count_distinct) == CommentToken or WhitespaceToken
lkml.parser DEBUG: . . . . . . Successfully parsed key.
lkml.parser DEBUG: . . . . . . Try to parse [value] = literal / quoted_literal / expression_block
lkml.parser DEBUG: . . . . . . . Check LiteralToken(count_distinct) == LiteralToken
lkml.parser DEBUG: . . . . . . Successfully parsed value.
lkml.parser DEBUG: . . . . . Successfully parsed pair.
lkml.parser DEBUG: . . . . . Check WhitespaceToken('\n    ') == CommentToken or WhitespaceToken
lkml.parser DEBUG: . . . . . Check LiteralToken(filters) == CommentToken or WhitespaceToken
lkml.parser DEBUG: . . . . . Check LiteralToken(filters) == StreamEndToken or BlockEndToken
lkml.parser DEBUG: . . . . . Try to parse [block] = key literal? '{' expression '}'
lkml.parser DEBUG: . . . . . . Try to parse [key] = literal ':'
lkml.parser DEBUG: . . . . . . . Check WhitespaceToken('\n    ') == CommentToken or WhitespaceToken
lkml.parser DEBUG: . . . . . . . Check LiteralToken(filters) == CommentToken or WhitespaceToken
lkml.parser DEBUG: . . . . . . . Check LiteralToken(filters) == LiteralToken
lkml.parser DEBUG: . . . . . . . Check ValueToken() == CommentToken or WhitespaceToken
lkml.parser DEBUG: . . . . . . . Check ValueToken() == ValueToken
lkml.parser DEBUG: . . . . . . . Check WhitespaceToken(' ') == CommentToken or WhitespaceToken
lkml.parser DEBUG: . . . . . . . Check ListStartToken() == CommentToken or WhitespaceToken
lkml.parser DEBUG: . . . . . . Successfully parsed key.
lkml.parser DEBUG: . . . . . . Check ListStartToken() == LiteralToken
lkml.parser DEBUG: . . . . . . Check ListStartToken() == CommentToken or WhitespaceToken
lkml.parser DEBUG: . . . . . . Check ListStartToken() == BlockStartToken
lkml.parser DEBUG: . . . . . Try to parse [pair] = key value
lkml.parser DEBUG: . . . . . . Try to parse [key] = literal ':'
lkml.parser DEBUG: . . . . . . . Check WhitespaceToken('\n    ') == CommentToken or WhitespaceToken
lkml.parser DEBUG: . . . . . . . Check LiteralToken(filters) == CommentToken or WhitespaceToken
lkml.parser DEBUG: . . . . . . . Check LiteralToken(filters) == LiteralToken
lkml.parser DEBUG: . . . . . . . Check ValueToken() == CommentToken or WhitespaceToken
lkml.parser DEBUG: . . . . . . . Check ValueToken() == ValueToken
lkml.parser DEBUG: . . . . . . . Check WhitespaceToken(' ') == CommentToken or WhitespaceToken
lkml.parser DEBUG: . . . . . . . Check ListStartToken() == CommentToken or WhitespaceToken
lkml.parser DEBUG: . . . . . . Successfully parsed key.
lkml.parser DEBUG: . . . . . . Try to parse [value] = literal / quoted_literal / expression_block
lkml.parser DEBUG: . . . . . . . Check ListStartToken() == LiteralToken
lkml.parser DEBUG: . . . . . . . Check ListStartToken() == QuotedLiteralToken
lkml.parser DEBUG: . . . . . . . Check ListStartToken() == ExpressionBlockToken
lkml.parser DEBUG: . . . . . Try to parse [list] = key '[' csv? ']'
lkml.parser DEBUG: . . . . . . Try to parse [key] = literal ':'
lkml.parser DEBUG: . . . . . . . Check WhitespaceToken('\n    ') == CommentToken or WhitespaceToken
lkml.parser DEBUG: . . . . . . . Check LiteralToken(filters) == CommentToken or WhitespaceToken
lkml.parser DEBUG: . . . . . . . Check LiteralToken(filters) == LiteralToken
lkml.parser DEBUG: . . . . . . . Check ValueToken() == CommentToken or WhitespaceToken
lkml.parser DEBUG: . . . . . . . Check ValueToken() == ValueToken
lkml.parser DEBUG: . . . . . . . Check WhitespaceToken(' ') == CommentToken or WhitespaceToken
lkml.parser DEBUG: . . . . . . . Check ListStartToken() == CommentToken or WhitespaceToken
lkml.parser DEBUG: . . . . . . Successfully parsed key.
lkml.parser DEBUG: . . . . . . Check ListStartToken() == CommentToken or WhitespaceToken
lkml.parser DEBUG: . . . . . . Check ListStartToken() == ListStartToken
lkml.parser DEBUG: . . . . . . Try to parse [csv] = (literal / quoted_literal) ("," (literal / quoted_literal))* ","?
lkml.parser DEBUG: . . . . . . . Try to parse [pair] = key value
lkml.parser DEBUG: . . . . . . . . Try to parse [key] = literal ':'
lkml.parser DEBUG: . . . . . . . . . Check WhitespaceToken(' ') == CommentToken or WhitespaceToken
lkml.parser DEBUG: . . . . . . . . . Check LiteralToken(state) == CommentToken or WhitespaceToken
lkml.parser DEBUG: . . . . . . . . . Check LiteralToken(state) == LiteralToken
lkml.parser DEBUG: . . . . . . . . . Check ValueToken() == CommentToken or WhitespaceToken
lkml.parser DEBUG: . . . . . . . . . Check ValueToken() == ValueToken
lkml.parser DEBUG: . . . . . . . . . Check WhitespaceToken(' ') == CommentToken or WhitespaceToken
lkml.parser DEBUG: . . . . . . . . . Check QuotedLiteralToken(CLOSED) == CommentToken or WhitespaceToken
lkml.parser DEBUG: . . . . . . . . Successfully parsed key.
lkml.parser DEBUG: . . . . . . . . Try to parse [value] = literal / quoted_literal / expression_block
lkml.parser DEBUG: . . . . . . . . . Check QuotedLiteralToken(CLOSED) == LiteralToken
lkml.parser DEBUG: . . . . . . . . . Check QuotedLiteralToken(CLOSED) == QuotedLiteralToken
lkml.parser DEBUG: . . . . . . . . Successfully parsed value.
lkml.parser DEBUG: . . . . . . . Successfully parsed pair.
lkml.parser DEBUG: . . . . . . . Check WhitespaceToken(' ') == CommentToken or WhitespaceToken
lkml.parser DEBUG: . . . . . . . Check CommaToken() == CommentToken or WhitespaceToken
lkml.parser DEBUG: . . . . . . . Check CommaToken() == ListEndToken
lkml.parser DEBUG: . . . . . . . Check WhitespaceToken(' ') == CommaToken
lkml.parser DEBUG: . . . . . . Check WhitespaceToken(' ') == CommentToken or WhitespaceToken
lkml.parser DEBUG: . . . . . . Check LiteralToken(state) == CommentToken or WhitespaceToken
lkml.parser DEBUG: . . . . . . Check LiteralToken(state) == ListEndToken
Traceback (most recent call last):
  File "/Users/hsheth/projects/datahub/metadata-ingestion/venv/bin/lkml", line 8, in <module>
    sys.exit(cli())
  File "/Users/hsheth/projects/datahub/metadata-ingestion/venv/lib/python3.9/site-packages/lkml/__init__.py", line 119, in cli
    result: dict = load(args.file)
  File "/Users/hsheth/projects/datahub/metadata-ingestion/venv/lib/python3.9/site-packages/lkml/__init__.py", line 50, in load
    tree: DocumentNode = parse(text)
  File "/Users/hsheth/projects/datahub/metadata-ingestion/venv/lib/python3.9/site-packages/lkml/__init__.py", line 29, in parse
    tree: DocumentNode = parser.parse()
  File "/Users/hsheth/projects/datahub/metadata-ingestion/venv/lib/python3.9/site-packages/lkml/parser.py", line 213, in parse
    container = self.parse_container()
  File "/Users/hsheth/projects/datahub/metadata-ingestion/venv/lib/python3.9/site-packages/lkml/parser.py", line 39, in wrapper
    result = fn(self, *args, **kwargs)
  File "/Users/hsheth/projects/datahub/metadata-ingestion/venv/lib/python3.9/site-packages/lkml/parser.py", line 237, in parse_container
    block = self.parse_block()
  File "/Users/hsheth/projects/datahub/metadata-ingestion/venv/lib/python3.9/site-packages/lkml/parser.py", line 39, in wrapper
    result = fn(self, *args, **kwargs)
  File "/Users/hsheth/projects/datahub/metadata-ingestion/venv/lib/python3.9/site-packages/lkml/parser.py", line 296, in parse_block
    container = self.parse_container()
  File "/Users/hsheth/projects/datahub/metadata-ingestion/venv/lib/python3.9/site-packages/lkml/parser.py", line 39, in wrapper
    result = fn(self, *args, **kwargs)
  File "/Users/hsheth/projects/datahub/metadata-ingestion/venv/lib/python3.9/site-packages/lkml/parser.py", line 237, in parse_container
    block = self.parse_block()
  File "/Users/hsheth/projects/datahub/metadata-ingestion/venv/lib/python3.9/site-packages/lkml/parser.py", line 39, in wrapper
    result = fn(self, *args, **kwargs)
  File "/Users/hsheth/projects/datahub/metadata-ingestion/venv/lib/python3.9/site-packages/lkml/parser.py", line 296, in parse_block
    container = self.parse_container()
  File "/Users/hsheth/projects/datahub/metadata-ingestion/venv/lib/python3.9/site-packages/lkml/parser.py", line 39, in wrapper
    result = fn(self, *args, **kwargs)
  File "/Users/hsheth/projects/datahub/metadata-ingestion/venv/lib/python3.9/site-packages/lkml/parser.py", line 253, in parse_container
    raise SyntaxError(
SyntaxError: Unable to find a matching expression for '<whitespace>' on line 15
zmjlawsonspot commented 3 years ago

I think I'm running into a similar issue that's presenting slightly differently. Specifically, when using leading commas like so:

measure: test_measure {
  type: sum
  sql: ${test_query} ;;
  view_label: " Measures"
  group_label: "Group One"
  label: "Group One"
  description: "Test"
  filters: [test: "Yes"
            , test_two: "-Monday,-Tuesday"
            , test_three: ">=8 AND <19"]
  hidden: yes
}
m-deck commented 3 years ago

I'm also observing this issue with leading commas.

SyntaxError: Unable to find a matching expression for '<whitespace>' on line 1442

1441     filters: [c.ta_yn: "No"
1442       ,j.p_s: "-MZ"
1443       ,j.i_p_c: "No"
1444     ]