aboutsummaryrefslogtreecommitdiffhomepage
path: root/lib/lexers/email.tes
blob: 11dbcf71a978d820480b1a78185d16ea01cdf522 (plain)
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
!*
 * E-Mail messages with signatures and quotes.
 *
 * NOTE: This is not a real lexer.
 * It only styles the document once.
 *!

@[lexer.test.email]{
  :EN*.emlQ*
}

@[lexer.set.email]{[:
  78ESSETEDGECOLUMN 1ESSETWRAPMODE
  !!1ESSETEDGEMODE

  :M[color.comment],1M[color.set]
  :M[color.preproc],2M[color.set]
  :M[color.preproc2],3M[color.set]

  ZU.z
  ZJ [_-:S^J-- ^J]_"S !* signatures *!
    4R .U.z
    ESSTARTSTYLING 1,(:-)ESSETSTYLING

    !* the signature is foldable *!
    ESLINEFROMPOSITIONU.l
    1024#(2^*13),Q.lESSETFOLDLEVEL
    <:L; 1025,%.lESSETFOLDLEVEL>
  '

  0U.l
  J< .-Q.z"= 1; '
    U.s
    0U.q <0A->"N1;' %.q <:C; 0A- "N 1; '>>

    Q.q"> !* quotes *!
      Q.sESSTARTSTYLING
      (Q.q-1">3|2'),(Q.lESLINELENGTH)ESSETSTYLING

      !* first line with higher quote level: will be the header *!
      (Q.l-1ESGETLINESTATE)-Q.q"< (1024+Q.q-1)#(2^*13) | (1024+Q.q) ',Q.lESSETFOLDLEVEL
      Q.q,Q.lESSETLINESTATE
    '
  :L; %.l>
]:}