Skip to content

Layout-Constraints.sdf3

pdmosses/sdf/org.metaborg.meta.lang.template/syntax/layout-constraints/Layout-Constraints.sdf3

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
module 

imports

  constants/NatCon
  constants/StrCon
  constants/IdentifierCon

template options

  keyword -/- [a-zA-Z0-9]

context-free sorts

  
  
  
  

context-free syntax

  .PosRef = NatCon
  .LiteralRef = StrCon
  .LabelRef = IdCon

  .First = <<ConstraintTreeRef>.first>
  .Left = <<ConstraintTreeRef>.left>
  .Right = <<ConstraintTreeRef>.right>
  .Last = <<ConstraintTreeRef>.last>

   = <(<ConstraintExp>)> {bracket}
  .Mul = <<ConstraintExp> * <ConstraintExp>> {left}
  .Div = <<ConstraintExp> / <ConstraintExp>> {left}
  .Add = <<ConstraintExp> + <ConstraintExp>> {left}
  .Sub = <<ConstraintExp> - <ConstraintExp>> {left}
  .Line = <<ConstraintToken>.line>
  .Col = <<ConstraintToken>.col>
  .Num = NatCon

   = <(<Constraint>)> {bracket}
  .Eq = <<ConstraintExp> == <ConstraintExp>> {non-assoc}
  .Lt = <<ConstraintExp> \< <ConstraintExp>> {non-assoc}
  .Le = <<ConstraintExp> \<= <ConstraintExp>> {non-assoc}
  .Gt = <<ConstraintExp> \> <ConstraintExp>> {non-assoc}
  .Ge = <<ConstraintExp> \>= <ConstraintExp>> {non-assoc}
  .Not = <!<Constraint>>
  .And = <<Constraint> && <Constraint>> {left}
  .Or = <<Constraint> || <Constraint>> {left}

  .Offside = <offside <ConstraintTreeRef> <{ConstraintTreeRef ", "}*>>
  .Indent = <indent <ConstraintTreeRef> <{ConstraintTreeRef ", "}+>>
  .Align = <align <ConstraintTreeRef> <{ConstraintTreeRef ", "}+>>
  .AlignList = <align-list <ConstraintTreeRef>>
  .NewLineIndent = <newline-indent <ConstraintTreeRef> <{ConstraintTreeRef ", "}+>>
  .SingleLine = <single-line <ConstraintTreeRef*>>

  .PPOffside = <pp-offside <ConstraintTreeRef> <{ConstraintTreeRef ", "}*>>
  .PPIndent = <pp-indent <ConstraintTreeRef> <{ConstraintTreeRef ", "}+>>
  .PPAlign = <pp-align <ConstraintTreeRef> <{ConstraintTreeRef ", "}+>>
  .PPAlignList = <pp-align-list <ConstraintTreeRef>>
  .PPNewLineIndent = <pp-newline-indent <ConstraintTreeRef> <{ConstraintTreeRef ", "}+>>
  .PPNewLineIndentBy = <pp-newline-indent-by(<NatCon>) <ConstraintTreeRef> <{ConstraintTreeRef ", "}+>>
  .PPNewLine = <pp-newline <ConstraintTreeRef>>
  .PPNewLineBy = <pp-newline(<NatCon>) <ConstraintTreeRef>>

context-free priorities

    Constraint.Not >
    {non-assoc:
      Constraint.Eq
      Constraint.Lt
      Constraint.Le
      Constraint.Gt
      Constraint.Ge
    } >
    Constraint.And >
    Constraint.Or,

    {left: ConstraintExp.Mul ConstraintExp.Div} > {left: ConstraintExp.Add ConstraintExp.Sub}