Skip to content

Commit 57c8c3c

Browse files
committed
Mark public symbols with public keyword
1 parent 784aa8c commit 57c8c3c

File tree

1 file changed

+70
-13
lines changed

1 file changed

+70
-13
lines changed

src/JuliaSyntax.jl

Lines changed: 70 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,80 @@
11
module JuliaSyntax
22

3-
# Conservative list of exports - only export the most common/useful things
4-
# here.
3+
macro _public(syms)
4+
if VERSION >= v"1.11"
5+
names = syms isa Symbol ? [syms] : syms.args
6+
esc(Expr(:public, names...))
7+
else
8+
nothing
9+
end
10+
end
11+
12+
# Public API, in the order of docs/src/api.md
13+
14+
# Parsing.
15+
export parsestmt,
16+
parseall,
17+
parseatom
18+
19+
@_public parse!,
20+
ParseStream,
21+
build_tree
522

6-
# Parsing. See also
7-
# parse!(), ParseStream
8-
export parsestmt, parseall, parseatom
923
# Tokenization
10-
export tokenize, Token, untokenize
11-
# Source file handling. See also
12-
# highlight() sourcetext() source_line() source_location()
24+
@_public tokenize,
25+
Token,
26+
untokenize
27+
28+
# Source file handling
29+
@_public sourcefile,
30+
byte_range,
31+
first_byte,
32+
last_byte,
33+
filename,
34+
source_line,
35+
source_location,
36+
sourcetext,
37+
highlight
38+
1339
export SourceFile
14-
# Expression heads/kinds. See also
15-
# flags() and related predicates.
16-
export @K_str, kind, head
17-
# Syntax tree types. See also
18-
# GreenNode
40+
@_public source_line_range
41+
42+
# Expression predicates, kinds and flags
43+
export @K_str, kind
44+
@_public Kind
45+
46+
@_public flags,
47+
SyntaxHead,
48+
head,
49+
is_trivia,
50+
is_prefix_call,
51+
is_infix_op_call,
52+
is_prefix_op_call,
53+
is_postfix_op_call,
54+
is_dotted,
55+
is_suffixed,
56+
is_decorated,
57+
numeric_flags,
58+
has_flags,
59+
TRIPLE_STRING_FLAG,
60+
RAW_STRING_FLAG,
61+
PARENS_FLAG,
62+
COLON_QUOTE,
63+
TOPLEVEL_SEMICOLONS_FLAG,
64+
MUTABLE_FLAG,
65+
BARE_MODULE_FLAG,
66+
SHORT_FORM_FUNCTION_FLAG
67+
68+
# Syntax trees
69+
@_public is_leaf,
70+
numchildren,
71+
children
72+
1973
export SyntaxNode
2074

75+
@_public GreenNode,
76+
span
77+
2178
# Helper utilities
2279
include("utils.jl")
2380

0 commit comments

Comments
 (0)