class Astrapi::Checker

Attributes

mm[RW]

the checker checks :

  • that classes are uniquely defined

  • that attrs are uniquely defined withing a given class

  • that attrs types are defined in the metamodel

Public Instance Methods

check(ast) click to toggle source
# File lib/checker.rb, line 15
def check ast
  @verbose=false
  @mm=ast
  ast.accept(self)
end
visitArrayOf(arrayOf,args=nil) click to toggle source
# File lib/checker.rb, line 49
def visitArrayOf arrayOf,args=nil
  indent "visitArrayOf"
  arrayOf.type.accept(self)
  dedent
end
visitAttr(attr,args=nil) click to toggle source
# File lib/checker.rb, line 37
def visitAttr attr,args=nil
  indent "visitAttr"
  attr.name.accept(self)
  attr.type.accept(self)
  dedent
end
visitIdentifier(id,args=nil) click to toggle source
# File lib/checker.rb, line 55
def visitIdentifier id,args=nil
  indent "visitIdentifier"
  say " - #{id}"
  dedent
end
visitKlass(klass,args=nil) click to toggle source
# File lib/checker.rb, line 28
def visitKlass klass,args=nil
  indent "visitKlass #{klass.name}"
  if klass.inheritance

  end
  klass.attrs.each{|attr| attr.accept(self)}
  dedent
end
visitModule(modul,args=nil) click to toggle source
# File lib/checker.rb, line 21
def visitModule modul,args=nil
  indent "visitModule"
  name=modul.name.accept(self)
  modul.classes.each{|k| k.accept(self)}
  dedent
end
visitType(type,args=nil) click to toggle source
# File lib/checker.rb, line 44
def visitType type,args=nil
  indent "visitType"
  dedent
end