Skip to content

Add basic IDL pretty-printer with AST indentation (Option 2 from #650) #772

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,6 @@ repos:
hooks:
- id: pyupgrade
stages: [pre-commit]

- repo: local
hooks:
- id: shellcheck
Expand All @@ -106,6 +105,15 @@ repos:
entry: shellcheck
args: ["--severity=error"]

- repo: local
hooks:
- id: format-idl
name: Format IDL files
entry: tools/format_idl.rb
language: system
types: [file]
files: \.idl$

- repo: https://github.com/scop/pre-commit-shfmt
rev: v3.11.0-1
hooks:
Expand Down
10 changes: 4 additions & 6 deletions backends/manual/templates/instruction.adoc.erb
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,16 @@

*<%= inst.long_name %>*

== Assembly format

`<%= inst.name %> <%= inst.assembly.gsub('x', 'r') %>`

== Synopsis
<%= inst.fix_entities(inst.description) %>

<%- if inst.data_independent_timing? -%>
[IMPORTANT]
This instruction must have data-independent timing when extension `Zkt` is enabled.
<%- end -%>

<%= inst.fix_entities(inst.description) %>
== Assembly format

`<%= inst.name %> <%= inst.assembly.gsub('x', 'r') %>`

== Decode Variables

Expand Down
2 changes: 2 additions & 0 deletions lib/idl.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

require "treetop"

$root ||= Pathname.new(File.expand_path("..", __dir__))

module Treetop
module Runtime
# open up Treetop::Runtime::CompiledParser and add a few utility functions
Expand Down
Loading
Loading