This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env ruby | |
| # Exhaustive cross-parser test: verifies prism and parse.y agree on syntax validity. | |
| # This file is auto-consolidated from multiple test rounds. | |
| cases = [] | |
| # 1a. fcall command_args: foo bar | |
| cases += [ | |
| ['foo bar in a', :err], # in requires arg | |
| ['foo bar and 1', :ok], # and works on expr |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <stdlib.h> | |
| #include <stdio.h> | |
| #include <pthread.h> | |
| static int value = 0xDEADBEEF; | |
| static _Thread_local void *tls = &value; | |
| static pthread_key_t key; | |
| void *worker(void *arg) { | |
| tls = (void*)0xCAFEBABE; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # frozen_string_literal: true | |
| class Number | |
| SIZE = 32 | |
| attr_reader :values | |
| def initialize(values = [0]) | |
| @values = values | |
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # frozen_string_literal: true | |
| class Context < BasicObject | |
| def method_missing(name, *) = :identifier | |
| def self.const_missing(name) = :constant | |
| end | |
| $context = Context.new | |
| def evaluate(encoding, codepoint) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import * as prism from "@ruby/prism"; | |
| class RubyInteger { | |
| constructor(value) { | |
| this.value = value; | |
| } | |
| _plus(other) { | |
| if (!(other instanceof RubyInteger)) { | |
| throw new TypeError(`no implicit conversion of ${other.constructor.name} into Integer`); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # frozen_string_literal: true | |
| require "bundler/inline" | |
| gemfile(true) do | |
| source "https://rubygems.org" | |
| gem "activerecord", "~> 7.0.0" | |
| gem "sqlite3" | |
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| require "yarp" | |
| module YARPAST | |
| def yarp_ast | |
| ast = | |
| begin | |
| RubyVM::AbstractSyntaxTree.of(self, keep_script_lines: true) | |
| rescue ArgumentError | |
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <stdbool.h> | |
| #include <stddef.h> | |
| #include <fcntl.h> | |
| #include <stdio.h> | |
| #include <stdlib.h> | |
| #include <sys/mman.h> | |
| #include <sys/stat.h> | |
| #include <unistd.h> | |
| // Each entry in this lookup table indicates whether a character is a valid |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| putspecialobject 3 | |
| putnil | |
| defineclass :FooBar, 0 | |
| definemethod :foo | |
| putobject "FooBar#foo" | |
| leave | |
| definemethod :bar | |
| putobject "class variable" | |
| setclassvariable :@@bar |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # frozen_string_literal: true | |
| require "bundler/inline" | |
| gemfile do | |
| source "https://rubygems.org" | |
| gem "json_pure" | |
| gem "benchmark-ips" | |
| end |
NewerOlder