Class: Astrapi::Checker
Constant Summary
Constants included from Indent
Instance Attribute Summary collapse
-
#mm ⇒ Object
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.
Instance Method Summary collapse
- #check(ast) ⇒ Object
- #visitArrayOf(arrayOf, args = nil) ⇒ Object
- #visitAttr(attr, args = nil) ⇒ Object
- #visitIdentifier(id, args = nil) ⇒ Object
- #visitKlass(klass, args = nil) ⇒ Object
- #visitModule(modul, args = nil) ⇒ Object
- #visitType(type, args = nil) ⇒ Object
Methods inherited from Visitor
Methods included from Indent
Instance Attribute Details
#mm ⇒ Object
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
13 14 15 |
# File 'lib/checker.rb', line 13 def mm @mm end |
Instance Method Details
#check(ast) ⇒ Object
15 16 17 18 19 |
# File 'lib/checker.rb', line 15 def check ast @verbose=false @mm=ast ast.accept(self) end |
#visitArrayOf(arrayOf, args = nil) ⇒ Object
49 50 51 52 53 |
# File 'lib/checker.rb', line 49 def visitArrayOf arrayOf,args=nil indent "visitArrayOf" arrayOf.type.accept(self) dedent end |
#visitAttr(attr, args = nil) ⇒ Object
37 38 39 40 41 42 |
# 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) ⇒ Object
55 56 57 58 59 |
# File 'lib/checker.rb', line 55 def visitIdentifier id,args=nil indent "visitIdentifier" say " - #{id}" dedent end |
#visitKlass(klass, args = nil) ⇒ Object
28 29 30 31 32 33 34 35 |
# 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) ⇒ Object
21 22 23 24 25 26 |
# 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) ⇒ Object
44 45 46 47 |
# File 'lib/checker.rb', line 44 def visitType type,args=nil indent "visitType" dedent end |