@@ -14,38 +14,40 @@ import (
1414
1515func init () {
1616 traversal .ConstructRegistry .Register (
17- reflect .TypeFor [* grammar.VerticalAnchorDefinitionContext ](),
17+ reflect .TypeFor [* grammar.VerticalAnchorContext ](),
1818 func (ctx antlr.ParserRuleContext , _ string , _ * traversal.Scope ) traversal.Construct {
19- anchor := ctx .(* grammar.VerticalAnchorDefinitionContext )
19+ anchor := ctx .(* grammar.VerticalAnchorContext )
2020
2121 if rule := anchor .VerticalAnchor_Absolute (); rule != nil {
22- value , err := strconv .Atoi (rule .Int ().GetText ())
23-
24- if err != nil {
25- return nil
22+ var value int
23+ if i := rule .Int (); i != nil {
24+ if v , err := strconv .Atoi (i .GetText ()); err == nil {
25+ value = v
26+ }
2627 }
27-
2828 return & VerticalAnchor {
2929 Type : VerticalAnchorType_Absolute ,
3030 Value : value ,
3131 }
3232 }
3333 if rule := anchor .VerticalAnchor_AboveBottom (); rule != nil {
34- value , err := strconv .Atoi (rule .Int ().GetText ())
35- fmt .Println ("Found above bottom" , value )
36- if err != nil {
37- return nil
34+ var value int
35+ if i := rule .Int (); i != nil {
36+ if v , err := strconv .Atoi (i .GetText ()); err == nil {
37+ value = v
38+ }
3839 }
3940 return & VerticalAnchor {
4041 Type : VerticalAnchorType_AboveBottom ,
4142 Value : value ,
4243 }
4344 }
4445 if rule := anchor .VerticalAnchor_BelowTop (); rule != nil {
45- value , err := strconv .Atoi (rule .Int ().GetText ())
46- fmt .Println ("Found below top" , value )
47- if err != nil {
48- return nil
46+ var value int
47+ if i := rule .Int (); i != nil {
48+ if v , err := strconv .Atoi (i .GetText ()); err == nil {
49+ value = v
50+ }
4951 }
5052 return & VerticalAnchor {
5153 Type : VerticalAnchorType_BelowTop ,
0 commit comments