-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsyntax_tester.do
106 lines (72 loc) · 2.29 KB
/
syntax_tester.do
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
*! An opening comment
* this do file really does nothing... it just makes sure that
* syntax is OK for do-files
version 10.1
// does this work?
local bleen
sysuse auto
regress /// has one space
mpg price
regress /// has one tab
mpg price
regress /// has space, then tab
mpg price
regress /// has tab, then space
mpg price
regress /// has space tab space tab space tab or so
mpg price
twoway scatter mpg weight
display "5 over 4 is " 5/4 // this will for sure be a problem
sum mpg //
// an empty line with a comment
//
sum turn displace // now for a comment with something in it.
tab foreign , sum(mpg)
twoway ///
(scatter mpg weight /// oops should be in a little farther
) ///
(lfit mpg weight)
regress mpg /// a comment
weight // here is something to be ignored /// this should be gone
display "this should be OK"
/* a simple comment --- doesn't go to Stata. Bug or feature? */
display "at the end" /* a comment at the end of a line */
display "multiline" /* a
multiline comment
which should be understood */
/* the following is OK, because /* */ trumps //?!? */
/* here is a nested /*
comment which has some // other things include "a string" */
inside of it */
regress mpg /* a comment inside a line */ weight head
regress mpg /* an old-school eol comment-out with leading *
*/ weight /*
*/ headroom /// a modern eol comment
turn /* a nested /* inline comment */ hahah */, beta
* here is a comment a the far margin
if `c(version)'==10 {
* here is a comment which is indented properly?
display "You need to upgrade"
}
display "between if and else "
else {
display "Running Stata X on Mac OS X, I hope."
}
/* * this could be strange */
display "here is open-c after a double-slash, which is an ordering problem" // here is an end-of-line /* oops
display "here is some odd nesting" /* // + " not here"
+ " should be silent" // */ /* + " what about this"
+ " or this?" */
capture program drop foobar
program define foobar
version 10.0
/* now things are indented properly */
display "hahaha made it to the end!!!"
end
exit
* some errors for testing
too many right-comments */
this should be a continuation ///
* this is known to fail---the open c-quote gets picked
* as special. It will not be fixed!
display "/* inside a quote ---eeekkkk---"