summaryrefslogtreecommitdiff
path: root/prism/templates
AgeCommit message (Collapse)Author
2024-03-06[ruby/prism] Move template related methods/classes under `Prism::Template` ↵Ufuk Kayserilioglu
namespace https://github.com/ruby/prism/commit/0e4dbcd3e4
2024-03-04[ruby/prism] Provide API for visiting in CKevin Newton
https://github.com/ruby/prism/commit/537947aa5c
2024-03-04[ruby/prism] Drop support for old ERBNobuyoshi Nakada
https://github.com/ruby/prism/commit/acdff3aae3
2024-03-04[ruby/prism] Use a more efficient StringIO on TruffleRubyBenoit Daloze
* The stdlib StringIO is synchronized and this occurs a high overhead. * This is about twice as fast on TruffleRuby but surprisingly it is slower on JRuby. I am not sure why but probably @ivar access and integer arithmetic is much slower than Java field access/arithmetic on JRuby. * On CRuby interpreter it is slower, which is expected as the GVL already protects StringIO. * So we enable this only on TruffleRuby to not slow down other Rubies. * PRISM_FFI_BACKEND=true ruby -v -Ilib -rprism -rbenchmark -e '300.times { p Benchmark.realtime { Dir.glob("lib/**/*.rb") { |f| Prism.parse_file(f) } } }' ruby 3.3.0: 0.215 => 0.251 (cext: 0.062) ruby 3.3.0 YJIT: 0.118 => 0.113 (cext: 0.053) truffleruby JVM: 0.101 => 0.054 jruby 9.4.6.0: 0.162 => 0.219 jruby 9.4.6.0 indy: 0.078 => 0.086 * For the record here are the numbers for using the String directly, without a StringIO-like object: ruby 3.3.0: 0.215 => 0.234 (cext: 0.062) ruby 3.3.0 YJIT: 0.118 => 0.111 (cext: 0.053) truffleruby native: 0.101 => 0.053 jruby 9.4.6.0: 0.162 => 0.195 jruby 9.4.6.0 indy: 0.078 => 0.082 As we can see, that extra object adds a non-trivial overhead on CRuby interpreter and JRuby. But we need to make it possible to use StringIO and SimpleStringIO interchangeably. https://github.com/ruby/prism/commit/938677cbd2
2024-03-04[ruby/prism] Make alloc interface replaceableHASUMI Hitoshi
- Add `x` prefix to malloc, calloc, realloc, and free (eg: malloc -> xmalloc) - By default, they are replaced with stdlib's functions at build - You can use custom functions by defining `PRISM_CUSTOM_ALLOCATOR` macro https://github.com/ruby/prism/commit/7a878af619
2024-02-29[ruby/prism] Lazily create Location objects in ↵Benoit Daloze
Prism::Serialize::Loader#load_location * Following the changes in #2428. * PRISM_FFI_BACKEND=true ruby -v -Ilib -rprism -rbenchmark -e '10.times { p Benchmark.realtime { Dir.glob("lib/**/*.rb") { |f| Prism.parse_file(f) } } }' ruby 3.3.0: 0.255 => 0.210 ruby 3.3.0 YJIT: 0.150 => 0.120 https://github.com/ruby/prism/commit/fabf809bbf
2024-02-29[ruby/prism] Resync RBI and test it in CIKevin Newton
https://github.com/ruby/prism/commit/4ef4032774
2024-02-28[ruby/prism] Rewrite logic for CHECK_FIELD_KIND to improve readabilityBenoit Daloze
https://github.com/ruby/prism/commit/f731edcc26
2024-02-28[ruby/prism] More precise types for NodeListField in prism.rbiBenoit Daloze
https://github.com/ruby/prism/commit/b7959295e9
2024-02-28[ruby/prism] Make NodeKindField subclass NodeKindFieldBenoit Daloze
* To avoid duplication. https://github.com/ruby/prism/commit/12e5aae0b4
2024-02-28[ruby/prism] Add a simple way to check field kinds are correct by setting ↵Benoit Daloze
$CHECK_FIELD_KIND https://github.com/ruby/prism/commit/33e987ba3c
2024-02-28[ruby/prism] Set proper types for node[] in Java-generated codeBenoit Daloze
https://github.com/ruby/prism/commit/322eaea500
2024-02-27[ruby/prism] Support -p, -n, -a, and -l command line optionsKevin Newton
https://github.com/ruby/prism/commit/959eb506ca
2024-02-24[ruby/prism] Less code modifications. More steep:ignore for nowGopal Patel
https://github.com/ruby/prism/commit/7905bdbf83
2024-02-24[ruby/prism] Replace awkward code changes with steep:ignoreGopal Patel
Also remove RBS for currently ignored files. Will follow-up when those check fully in later PRs. https://github.com/ruby/prism/commit/2cae58f86d
2024-02-24[ruby/prism] Relax Location#source to be optionalGopal Patel
https://github.com/ruby/prism/commit/9f00fe7510
2024-02-24[ruby/prism] Remove Ripper from public RBS, type-assert remaining issuesGopal Patel
https://github.com/ruby/prism/commit/5fda7a0760
2024-02-24[ruby/prism] Split private typesGopal Patel
https://github.com/ruby/prism/commit/0209d093ec
2024-02-24[ruby/prism] wip: node unionsGopal Patel
https://github.com/ruby/prism/commit/99a71675d4
2024-02-24[ruby/prism] Use steep to type check RBS and Ruby filesGopal Patel
https://github.com/ruby/prism/commit/eabed9f4fd
2024-02-23[PRISM] Sync to latest prismKevin Newton
2024-02-23[ruby/prism] Convert pm_integer_t to stringsKevin Newton
https://github.com/ruby/prism/commit/fa9a30ad91
2024-02-23[ruby/prism] Duplicated hash keysKevin Newton
https://github.com/ruby/prism/commit/3e10c46c14
2024-02-22[ruby/prism] Parse float valuesKevin Newton
https://github.com/ruby/prism/commit/9137226a52
2024-02-22[ruby/prism] Regenerate snapshots using integer valuesKevin Newton
2024-02-22[ruby/prism] Add an IntegerField for parsing integer valuesKevin Newton
https://github.com/ruby/prism/commit/120d8c0479
2024-02-21[ruby/prism] Remove non-ASCII characters from --dump=parsetreeKevin Newton
https://github.com/ruby/prism/commit/6d4cd21e98
2024-02-20[ruby/prism] Use `_POSIX_MAPPED_FILES` and `_WIN32` to know if memory map ↵HASUMI Hitoshi
interface is available in the target platform https://github.com/ruby/prism/commit/88e2ff52d4
2024-02-18[ruby/prism] Lazy methods for start and end offset on nodeKevin Newton
https://github.com/ruby/prism/commit/4510e2746d
2024-02-17[ruby/prism] Provide the ability to dump AST to JSON from CKevin Newton
https://github.com/ruby/prism/commit/d3a149efc5
2024-02-16[ruby/prism] BuiltinsKevin Newton
https://github.com/ruby/prism/commit/851f2571ff
2024-02-15[ruby/prism] Make location methods thread-safeBenoit Daloze
* Before it could result in NoMethodError if multiple threads were calling location methods: https://gist.github.com/eregon/b78b7f266d7ee0a278a389cfd1782232 https://github.com/ruby/prism/commit/ff762dcccd
2024-02-15[PRISM] Sync prism version bumpKevin Newton
2024-02-15[ruby/prism] Speed up creating Ruby ASTKevin Newton
When creating the Ruby AST, we were previously allocating Location objects for every node and every inner location. Instead, this commit changes it to pack both the start offset and length into a single u64 and pass that into the nodes. Then, when the locations are requested via a reader method, we lazily allocate the Location objects. https://github.com/ruby/prism/commit/de203dca83 Co-Authored-By: Aaron Patterson <tenderlove@ruby-lang.org>
2024-02-14[PRISM] Correctly hook up line numbers for evalKevin Newton
2024-02-14Prefer `Array.new(n) {}` to `n.times.map {}`Benoit Daloze
* It is quite a bit faster: ruby -rbenchmark/ips -e 'Benchmark.ips { |x| x.report("times.map") { 1000.times.map {} }; x.report("Array.new") { Array.new(1000) {} }; x.compare! }' ruby 3.3.0 (2023-12-25 revision 5124f9ac75) [x86_64-linux] Warming up -------------------------------------- times.map 976.000 i/100ms Array.new 1.641k i/100ms Calculating ------------------------------------- times.map 9.808k (± 0.3%) i/s - 49.776k in 5.075013s Array.new 16.601k (± 1.0%) i/s - 83.691k in 5.041970s Comparison: Array.new: 16600.8 i/s times.map: 9808.2 i/s - 1.69x slower
2024-02-14Initialize the Prism::Source directly with all 3 fields for the C extensionBenoit Daloze
* Faster that way: $ ruby -Ilib -rprism -rbenchmark/ips -e 'Benchmark.ips { |x| x.report("parse") { Prism.parse("1 + 2") } }' 195.722k (± 0.5%) i/s rb_iv_set(): 179.609k (± 0.5%) i/s rb_funcall(): 190.030k (± 0.3%) i/s before this PR: 183.319k (± 0.4%) i/s
2024-02-14[ruby/prism] Remove attr_writer's for ParseResult#start_line and #offsetsBenoit Daloze
* As the user should not set these. * Use #instance_variable_set/rb_iv_set() instead internally. https://github.com/ruby/prism/commit/cace09fb8c
2024-02-14[ruby/prism] Serialize the newline_list to avoid recomputing it again laterBenoit Daloze
* Fixes https://github.com/ruby/prism/issues/2380 https://github.com/ruby/prism/commit/4eaaa90114
2024-02-14[PRISM] Sync to latest prismKevin Newton
2024-02-14[ruby/prism] Match up token name to CRubyKevin Newton
https://github.com/ruby/prism/commit/cf0369a5c7
2024-02-12[ruby/prism] Error messages closer to CRubyKevin Newton
https://github.com/ruby/prism/commit/19ffa0b980
2024-02-07Bump prism versionKevin Newton
2024-02-07[ruby/prism] Support for Ruby 2.7Kevin Newton
https://github.com/ruby/prism/commit/1a15b70a8e
2024-02-05[ruby/prism] Add another error type for raising argument errorsKevin Newton
https://github.com/ruby/prism/commit/f3030cb2b2
2024-02-05Sync to latest prismKevin Newton
2024-02-01[ruby/prism] Add parentheses around macro argumentsJenny Shen
https://github.com/ruby/prism/commit/f81fe9c716 Co-authored-by: Adrianna Chang <adrianna.chang@shopify.com> Co-authored-by: Peter Zhu <peter@peterzhu.ca>
2024-02-01Sync to latest prismKevin Newton
2024-01-30[ruby/prism] Better error messages for unexpected tokens in prefixKevin Newton
https://github.com/ruby/prism/commit/a35b8e45ee
2024-01-27[ruby/prism] Error follow-upKevin Newton
Split up the diagnostic levels so that error and warning levels aren't mixed. Also fix up deconstruct_keys implementation. https://github.com/ruby/prism/commit/bd3eeb308d Co-authored-by: Benoit Daloze <eregontp@gmail.com>