Skip to content

Whitespace.sdf3

pdmosses/metaborg-tiger/org.metaborg.lang.tiger.statix/syntax/Whitespace.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
module Whitespace

lexical sorts
   InsideComment SingleLineComment NewLineEOF 

lexical syntax

  LAYOUT         = [\ \t\n\r]
      = [\*]
  LAYOUT         = "/*" InsideComment* "*/"
  InsideComment  = ~[\*]
  InsideComment  = CommentChar
  LAYOUT         = SingleLineComment
  SingleLineComment = "//" ~[\n\r]* NewLineEOF
  NewLineEOF     = [\n\r]
  NewLineEOF     = EOF
              =

lexical restrictions

  // Ensure greedy matching for lexicals

  CommentChar   -/- [\/]
  EOF -/- ~[]

context-free restrictions

  // Ensure greedy matching for comments

  LAYOUT? -/- [\ \t\n\r]
  LAYOUT? -/- [\/].[\/]
  LAYOUT? -/- [\/].[\*]