Skip to content

Commit

Permalink
parser: fix some more failing tests
Browse files Browse the repository at this point in the history
  • Loading branch information
AntonLydike committed Jan 18, 2023
1 parent 856339e commit 299e05e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
2 changes: 1 addition & 1 deletion xdsl/dialects/llvm.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ def print_parameters(self, printer: Printer) -> None:
def parse_parameters(parser: BaseParser) -> list[Attribute]:
parser.must_parse_characters("<(", "LLVM Struct must start with `<(`")
params = parser.must_parse_list_of(
parser.try_parse_attribute,
parser.try_parse_type,
"Malformed LLVM struct, expected attribute definition here!")
parser.must_parse_characters(
")>", "Unexpected input, expected end of LLVM struct!")
Expand Down
7 changes: 5 additions & 2 deletions xdsl/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -580,7 +580,7 @@ class ParserCommons:

integer_literal = re.compile(r"[+-]?([0-9]+|0x[0-9A-Fa-f]+)")
decimal_literal = re.compile(r"[+-]?([1-9][0-9]*)")
string_literal = re.compile(r'"(\\[nfvr"\\]|[^\n\f\v\r"\\])*"')
string_literal = re.compile(r'"(\\[nfvtr"\\]|[^\n\f\v\r"\\])*"')
float_literal = re.compile(r"[-+]?[0-9]+\.[0-9]*([eE][-+]?[0-9]+)?")
bare_id = re.compile(r"[A-Za-z_][\w$.]+")
value_id = re.compile(r"%([0-9]+|([A-Za-z_$.-][\w$.-]*))")
Expand Down Expand Up @@ -990,7 +990,7 @@ def must_parse_vector_attrs(self) -> AnyVectorType:
self.raise_error(
"Expected a type at the end of the vector parameters!")

return VectorType.from_type_and_list(type, shape)
return VectorType.from_element_type_and_shape(type, shape)

def must_parse_tensor_or_memref_dims(self) -> list[int] | None:
with self.tokenizer.configured(break_on=self.tokenizer.break_on +
Expand Down Expand Up @@ -1867,6 +1867,9 @@ def must_parse_op_args_list(self) -> list[Span]:
return [name for name, _ in args]


def try_parse_type(self) -> Attribute | None:
return self.try_parse_attribute()

# COMPAT layer so parser_ng is a drop-in replacement for parser:


Expand Down

0 comments on commit 299e05e

Please sign in to comment.