Move error from top_stmts and top_stmt to stmt

By this change, syntax error is recovered smaller units.
In the case below, "DEFN :bar" is same level with "CLASS :Foo"
now.

```
module Z
  class Foo
    foo.
  end

  def bar
  end
end
```

[Feature #19013]
This commit is contained in:
yui-knk 2022-10-01 17:44:28 +09:00 committed by Yuichiro Kaneko
parent 4f24f3ea94
commit 4bfdf6d06d
Notes: git 2022-10-08 17:59:34 +09:00
7 changed files with 41 additions and 30 deletions

2
node.h
View file

@ -125,6 +125,7 @@ enum node_type {
NODE_ARYPTN,
NODE_HSHPTN,
NODE_FNDPTN,
NODE_ERROR,
NODE_LAST
};
@ -386,6 +387,7 @@ typedef struct RNode {
#define NEW_PREEXE(b,loc) NEW_SCOPE(b,loc)
#define NEW_POSTEXE(b,loc) NEW_NODE(NODE_POSTEXE,0,b,0,loc)
#define NEW_ATTRASGN(r,m,a,loc) NEW_NODE(NODE_ATTRASGN,r,m,a,loc)
#define NEW_ERROR(loc) NEW_NODE(NODE_ERROR,0,0,0,loc)
#define NODE_SPECIAL_REQUIRED_KEYWORD ((NODE *)-1)
#define NODE_REQUIRED_KEYWORD_P(node) ((node)->nd_value == NODE_SPECIAL_REQUIRED_KEYWORD)