Skip to content

Commit

Permalink
removed union_type and object_type and replaced them with binary_expr…
Browse files Browse the repository at this point in the history
…ession and object
  • Loading branch information
azizghuloum committed Nov 25, 2024
1 parent a8ae855 commit d22b9ae
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 6 deletions.
4 changes: 0 additions & 4 deletions src/AST.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,12 +49,10 @@ export type list_tag =
| "predefined_type"
| "literal_type"
| "tuple_type"
| "object_type"
| "pair"
| "object"
| "array_pattern"
| "object_pattern"
| "union_type"
| "slice"
| "ERROR";

Expand Down Expand Up @@ -83,12 +81,10 @@ export const list_tags: { [k in list_tag]: list_tag } = {
predefined_type: "predefined_type",
literal_type: "literal_type",
tuple_type: "tuple_type",
object_type: "object_type",
pair: "pair",
object: "object",
object_pattern: "object_pattern",
array_pattern: "array_pattern",
union_type: "union_type",
ERROR: "ERROR",
};

Expand Down
2 changes: 1 addition & 1 deletion src/ASTVis.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ const colormap: { [k in AST.atom_tag]: string } = {
number: "magenta",
type_identifier: "orange",
jsx_text: "teal",
string_fragment: "cyan",
string: "cyan",
regex_pattern: "magenta",
other: "grey",
ERROR: "red",
Expand Down
2 changes: 1 addition & 1 deletion src/expander.ts
Original file line number Diff line number Diff line change
Expand Up @@ -454,7 +454,7 @@ function find_form(loc: Loc): ffrv {
const { tag } = loc.t;
const action = list_handlers_table[tag];
if (action === undefined) {
throw new Error(`no stop_table entry for ${tag}`);
debug(loc, `no stop_table entry for ${tag}`);
}
switch (action) {
case "descend":
Expand Down
6 changes: 6 additions & 0 deletions src/parser-loader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,12 @@ function absurdly(node: Parser.SyntaxNode): AST {
return { type: "list", tag: "required_parameter", content: array_to_ll(ls) };
}
}
case "union_type": {
return { type: "list", tag: "binary_expression", content: array_to_ll(ls) };
}
case "object_type": {
return { type: "list", tag: "object", content: array_to_ll(ls) };
}
case "arrow_function": {
if (ls.length === 3) {
const fmls = ls[0];
Expand Down

0 comments on commit d22b9ae

Please sign in to comment.