Skip to content

Commit 08a0b67

Browse files
committed
[GR-45043] Adopt latest changes in Prism
PullRequest: truffleruby/4186
2 parents 1d89a7e + 571ca58 commit 08a0b67

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

50 files changed

+8961
-2454
lines changed

spec/truffle/parsing/fixtures/ensure/in_do_end_block.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,8 @@ ast: |
6969
EnsureNodeGen
7070
attributes:
7171
flags = 0
72-
sourceCharIndex = 10
73-
sourceLength = 22
72+
sourceCharIndex = 5
73+
sourceLength = 27
7474
children:
7575
ensurePart =
7676
RubyCallNode

spec/truffle/parsing/fixtures/ensure/in_method.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,8 +78,8 @@ ast: |
7878
EnsureNodeGen
7979
attributes:
8080
flags = 0
81-
sourceCharIndex = 10
82-
sourceLength = 22
81+
sourceCharIndex = 0
82+
sourceLength = 32
8383
children:
8484
ensurePart =
8585
RubyCallNode

spec/truffle/parsing/fixtures/ensure/in_module.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,8 +87,8 @@ ast: |
8787
EnsureNodeGen
8888
attributes:
8989
flags = 0
90-
sourceCharIndex = 13
91-
sourceLength = 22
90+
sourceCharIndex = 0
91+
sourceLength = 35
9292
children:
9393
ensurePart =
9494
RubyCallNode

spec/truffle/parsing/fixtures/rescue/backtrace_optimization/enabled/when_local_variable_defined_in_outer_scope.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,8 +72,8 @@ ast: |
7272
TryNodeGen
7373
attributes:
7474
flags = 0
75-
sourceCharIndex = 20
76-
sourceLength = 22
75+
sourceCharIndex = 15
76+
sourceLength = 27
7777
children:
7878
rescueParts = [
7979
RescueStandardErrorNode

spec/truffle/parsing/fixtures/rescue/in_do_end_block.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,8 @@ ast: |
6969
TryNodeGen
7070
attributes:
7171
flags = 0
72-
sourceCharIndex = 10
73-
sourceLength = 21
72+
sourceCharIndex = 5
73+
sourceLength = 26
7474
children:
7575
rescueParts = [
7676
RescueStandardErrorNode

spec/truffle/parsing/fixtures/rescue/in_method.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,8 +78,8 @@ ast: |
7878
TryNodeGen
7979
attributes:
8080
flags = 0
81-
sourceCharIndex = 10
82-
sourceLength = 21
81+
sourceCharIndex = 0
82+
sourceLength = 31
8383
children:
8484
rescueParts = [
8585
RescueStandardErrorNode

spec/truffle/parsing/fixtures/rescue/in_module.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,8 +87,8 @@ ast: |
8787
TryNodeGen
8888
attributes:
8989
flags = 0
90-
sourceCharIndex = 13
91-
sourceLength = 21
90+
sourceCharIndex = 0
91+
sourceLength = 34
9292
children:
9393
rescueParts = [
9494
RescueStandardErrorNode

src/main/c/yarp/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ FUZZ_OUTPUT_DIR = $(shell pwd)/fuzz/output
1111
SOEXT := $(shell ruby -e 'puts RbConfig::CONFIG["SOEXT"]')
1212

1313
CPPFLAGS := -Iinclude
14-
CFLAGS := -g -O2 -std=c99 -Wall -Werror -Wextra -Wpedantic -Wundef -Wconversion -Wno-missing-braces -fPIC -fvisibility=hidden
14+
CFLAGS := -g -O2 -std=c99 -Wall -Werror -Wextra -Wpedantic -Wundef -Wconversion -Wno-missing-braces -fPIC -fvisibility=hidden $(CFLAGS)
1515
CC := cc
1616
WASI_SDK_PATH := /opt/wasi-sdk
1717

src/main/c/yarp/include/prism.h

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
#include "prism/defines.h"
1010
#include "prism/util/pm_buffer.h"
1111
#include "prism/util/pm_char.h"
12+
#include "prism/util/pm_integer.h"
1213
#include "prism/util/pm_memchr.h"
1314
#include "prism/util/pm_strncasecmp.h"
1415
#include "prism/util/pm_strpbrk.h"
@@ -24,6 +25,7 @@
2425

2526
#include <assert.h>
2627
#include <errno.h>
28+
#include <math.h>
2729
#include <stdarg.h>
2830
#include <stdbool.h>
2931
#include <stdint.h>
@@ -187,6 +189,15 @@ const char * pm_token_type_human(pm_token_type_t token_type);
187189
*/
188190
PRISM_EXPORTED_FUNCTION void pm_parser_errors_format(const pm_parser_t *parser, pm_buffer_t *buffer, bool colorize);
189191

192+
/**
193+
* Dump JSON to the given buffer.
194+
*
195+
* @param buffer The buffer to serialize to.
196+
* @param parser The parser that parsed the node.
197+
* @param node The node to serialize.
198+
*/
199+
PRISM_EXPORTED_FUNCTION void pm_dump_json(pm_buffer_t *buffer, const pm_parser_t *parser, const pm_node_t *node);
200+
190201
/**
191202
* @mainpage
192203
*

0 commit comments

Comments
 (0)