Add a function to check if a tree node has a scope.
This commit is contained in:
parent
b6ab42f53a
commit
77123561f0
|
@ -98,6 +98,13 @@ int libab_tree_has_string(libab_tree_variant var);
|
||||||
* @return true if the tree node variant contains a type.
|
* @return true if the tree node variant contains a type.
|
||||||
*/
|
*/
|
||||||
int libab_tree_has_type(libab_tree_variant var);
|
int libab_tree_has_type(libab_tree_variant var);
|
||||||
|
/**
|
||||||
|
* Determines if the given tree node
|
||||||
|
* variant contains a scope.
|
||||||
|
* @param var the variant of the tree node.
|
||||||
|
* @return true if the node variant contains a scope.
|
||||||
|
*/
|
||||||
|
int libab_tree_has_scope(libab_tree_variant var);
|
||||||
/**
|
/**
|
||||||
* Determines if the given tree node variant
|
* Determines if the given tree node variant
|
||||||
* should contain a vector.
|
* should contain a vector.
|
||||||
|
|
|
@ -16,6 +16,12 @@ int libab_tree_has_string(libab_tree_variant variant) {
|
||||||
variant == TREE_RESERVED_OP;
|
variant == TREE_RESERVED_OP;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int libab_tree_has_scope(libab_tree_variant variant) {
|
||||||
|
return variant == TREE_BASE || variant == TREE_BLOCK ||
|
||||||
|
variant == TREE_IF || variant == TREE_WHILE ||
|
||||||
|
variant == TREE_DOWHILE || variant == TREE_FUN;
|
||||||
|
}
|
||||||
|
|
||||||
int libab_tree_has_type(libab_tree_variant variant) {
|
int libab_tree_has_type(libab_tree_variant variant) {
|
||||||
return variant == TREE_FUN_PARAM || variant == TREE_FUN;
|
return variant == TREE_FUN_PARAM || variant == TREE_FUN;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user