Skip to content

Commit

Permalink
Merge pull request #493 from ydah/rbs-inline-follow
Browse files Browse the repository at this point in the history
Follow-up on development with rbs-inline
  • Loading branch information
ydah authored Dec 27, 2024
2 parents 0e880d9 + 0820943 commit 317b7d1
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 1 deletion.
9 changes: 9 additions & 0 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,15 @@ jobs:
bundler-cache: true
- run: bundle install
- run: bundle exec rbs collection install
- run: bundle exec rbs-inline --output lib/
- name: Check for uncommitted changes
run: |
if [ -n "$(git status --porcelain)" ]; then
echo "Uncommitted changes detected after running rbs-inline."
echo "Please run 'bundle rake rbs_inline' and commit the changes generated by rbs-inline." >&2
exit 1
fi
shell: bash
- run: bundle exec steep check
test-ruby:
runs-on: ubuntu-20.04
Expand Down
9 changes: 9 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ Lrama is LALR (1) parser generator written by Ruby. The first goal of this proje
- [Supported Ruby version](#supported-ruby-version)
- [Development](#development)
- [How to generate parser.rb](#how-to-generate-parserrb)
- [How to Write a Type Signature](#how-to-write-a-type-signature)
- [Test](#test)
- [Call-stack Profiling Lrama](#call-stack-profiling-lrama)
- [1. Create parse.tmp.y in ruby/ruby](#1-create-parsetmpy-in-rubyruby)
Expand Down Expand Up @@ -118,6 +119,14 @@ $ bundle exec rake build:parser
`parser.rb` is generated from `parser.y` by Racc.
Run the rake command when you update `parser.y` then commit changes of both files.

### How to Write a Type Signature

We use [Steep](https://github.com/soutaro/steep) for type checking and [rbs-inline](https://github.com/soutaro/rbs-inline) for type declarations.

Currently, type signatures are declared in the [sig/lrama](https://github.com/ruby/lrama/blob/master/sig/lrama) directory. However, these files will be replaced with `rbs-inline`. This means type signatures should be written directly in the source code.

For guidance on writing type signatures, refer to the [Syntax Guide](https://github.com/soutaro/rbs-inline/wiki/Syntax-guide) in the rbs-inline documentation.

### Test

Running tests:
Expand Down
7 changes: 6 additions & 1 deletion Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,9 @@ task :steep do
sh "bundle exec steep check"
end

task default: %i[spec steep]
desc "Run rbs-inline"
task :rbs_inline do
sh "bundle exec rbs-inline --output lib/"
end

task default: %i[spec rbs_inline steep]

0 comments on commit 317b7d1

Please sign in to comment.