summaryrefslogtreecommitdiff
path: root/tests/lexers/redcode/example.txt
blob: e600089a17190111a24c0bda4e8068a7c1858e29 (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
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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
---input---
;redcode
;name          Dwarf
;author        A. K. Dewdney
;version       94.1
;date          April 29, 1993
;strategy      Bombs every fourth instruction.
        ORG     start              ; Indicates the instruction with
                                   ; the label "start" should be the
                                   ; first to execute.
step    EQU      4                 ; Replaces all occurrences of "step"
                                   ; with the character "4".
target  DAT.F   #0,     #0         ; Pointer to target instruction.
start   ADD.AB  #step,   target    ; Increments pointer by step.
        MOV.AB  #0,     @target    ; Bombs target instruction.
        JMP.A    start             ; Same as JMP.A -2.  Loops back to
                                   ; the instruction labelled "start".
        END

---tokens---
';redcode'    Comment.Single
'\n'          Text

';name          Dwarf' Comment.Single
'\n'          Text

';author        A. K. Dewdney' Comment.Single
'\n'          Text

';version       94.1' Comment.Single
'\n'          Text

';date          April 29, 1993' Comment.Single
'\n'          Text

';strategy      Bombs every fourth instruction.' Comment.Single
'\n        '  Text
'ORG'         Name.Function
'     '       Text
'start'       Name
'              ' Text
'; Indicates the instruction with' Comment.Single
'\n                                   ' Text
'; the label "start" should be the' Comment.Single
'\n                                   ' Text
'; first to execute.' Comment.Single
'\n'          Text

'step'        Name
'    '        Text
'EQU'         Name.Function
'      '      Text
'4'           Literal.Number.Integer
'                 ' Text
'; Replaces all occurrences of "step"' Comment.Single
'\n                                   ' Text
'; with the character "4".' Comment.Single
'\n'          Text

'target'      Name
'  '          Text
'DAT'         Name.Function
'.'           Punctuation
'F'           Name.Decorator
'   '         Text
'#'           Operator
'0'           Literal.Number.Integer
','           Punctuation
'     '       Text
'#'           Operator
'0'           Literal.Number.Integer
'         '   Text
'; Pointer to target instruction.' Comment.Single
'\n'          Text

'start'       Name
'   '         Text
'ADD'         Name.Function
'.'           Punctuation
'AB'          Name.Decorator
'  '          Text
'#'           Operator
'step'        Name
','           Punctuation
'   '         Text
'target'      Name
'    '        Text
'; Increments pointer by step.' Comment.Single
'\n        '  Text
'MOV'         Name.Function
'.'           Punctuation
'AB'          Name.Decorator
'  '          Text
'#'           Operator
'0'           Literal.Number.Integer
','           Punctuation
'     '       Text
'@'           Operator
'target'      Name
'    '        Text
'; Bombs target instruction.' Comment.Single
'\n        '  Text
'JMP'         Name.Function
'.'           Punctuation
'A'           Name.Decorator
'    '        Text
'start'       Name
'             ' Text
'; Same as JMP.A -2.  Loops back to' Comment.Single
'\n                                   ' Text
'; the instruction labelled "start".' Comment.Single
'\n        '  Text
'END'         Name.Function
'\n'          Text