Skip to content

Commit

Permalink
Some small things
Browse files Browse the repository at this point in the history
  • Loading branch information
Snektron committed Jul 2, 2021
1 parent 00bc959 commit a5cc950
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/compiler/passes/fix_bin_ops.fut
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ let fix_bin_ops [n] (node_types: [n]production.t) (parents: [n]i32) =
-- Generate the new nodes list simply by scattering. To avoid a filter here, simply set the scatter target
-- index of a node that shouldn't be moved up to out of bounds, which scatter will ignore for us.
--
-- Use the old parents here so it also works for right-associative nodes.
-- Use the old parents here so it also works for right-associative nodes and also scatters up the list ends.
|> map2 (\parent is_tail_node -> if is_tail_node then parent else -1) parents
|> map i64.i32
in scatter
Expand Down
4 changes: 1 addition & 3 deletions src/compiler/passes/symbol_resolution.fut
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ let resolve_vars [n] (node_types: [n]production.t) (parents: [n]i32) (prev_sibli
else if prev_siblings[prev_sibling] == -1 then parent
-- Else point to the right leaf of the second sibling, which is the condition
else right_leafs[prev_sibling]
else if node_types[parent] == production_stat_if || node_types[parent] == production_stat_if_else || node_types[parent] == production_stat_while then
else if node_types[parent] == production_stat_if || node_types[parent] == production_stat_if_else then
-- For `<keyword> condition block...;` type statements, we want don't want declarations in the condition or children
-- to be visible from a node after the statement, but we do want declarations in the condition to be visible in the
-- children. We also don't want declarations in child A to be visible in child B, so if the parent of a node is
Expand Down Expand Up @@ -163,8 +163,6 @@ let resolve_args [n] (node_types: [n]production.t) (parents: [n]i32) (prev_sibli
-- of the called function.
let grandparents = map (\parent -> if parent == -1 then -1 else parents[parent]) parents
-- Some useful masks
-- let grandparent_is_proto = map (\gp -> gp != -1 && node_types[gp] == production_atom_fn_proto) grandparents
-- let grandparent_is_call = map (\gp -> gp != -1 && node_types[gp] == production_atom_fn_call) grandparents
let is_first_child = map (== -1) prev_siblings
let is_last_child = map (== -1) next_siblings
-- Scatter up that first parameter.
Expand Down
4 changes: 2 additions & 2 deletions src/lpg/parser/llp/render.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -139,8 +139,8 @@ namespace pareas::parser::llp {
uint64_t ParserRenderer::bracket_id(const Symbol& sym, bool left) const {
auto id = this->symbol_mapping.at(sym);

// Left brackets get odd ID's, rightb rackets get even ID's.
// This way, we can perform a simply subtract and reduce by bit and to
// Left brackets get odd ID's, right brackets get even ID's.
// This way, we can perform a simple subtract and reduce by bit and to
// check if all the brackets match up.
return left ? id * 2 + 1 : id * 2;
}
Expand Down

0 comments on commit a5cc950

Please sign in to comment.