Class: Collie::Formatter::Signature

Inherits:
Object
  • Object
show all
Defined in:
lib/collie/formatter/signature.rb

Overview

Semantic signature for verifying that formatting preserved grammar structure.

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.build(ast) ⇒ Object



7
8
9
# File 'lib/collie/formatter/signature.rb', line 7

def self.build(ast)
  new.build(ast)
end

Instance Method Details

#build(ast) ⇒ Object



11
12
13
14
15
16
17
18
19
# File 'lib/collie/formatter/signature.rb', line 11

def build(ast)
  [
    :grammar,
    ast.prologue&.code,
    ast.declarations.map { |declaration| declaration_signature(declaration) },
    ast.rules.map { |rule| rule_signature(rule) },
    ast.epilogue&.code
  ]
end