Skip to content

Commit bafc712

Browse files
committed
Mark public symbols with public keyword
1 parent 0a51f3d commit bafc712

File tree

1 file changed

+71
-13
lines changed

1 file changed

+71
-13
lines changed

src/JuliaSyntax.jl

Lines changed: 71 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,81 @@
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() char_range()
24+
@_public tokenize,
25+
Token,
26+
untokenize
27+
28+
# Source file handling
29+
@_public sourcefile,
30+
byte_range,
31+
char_range,
32+
first_byte,
33+
last_byte,
34+
filename,
35+
source_line,
36+
source_location,
37+
sourcetext,
38+
highlight
39+
1340
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
41+
@_public source_line_range
42+
43+
# Expression predicates, kinds and flags
44+
export @K_str, kind
45+
@_public Kind
46+
47+
@_public flags,
48+
SyntaxHead,
49+
head,
50+
is_trivia,
51+
is_prefix_call,
52+
is_infix_op_call,
53+
is_prefix_op_call,
54+
is_postfix_op_call,
55+
is_dotted,
56+
is_suffixed,
57+
is_decorated,
58+
numeric_flags,
59+
has_flags,
60+
TRIPLE_STRING_FLAG,
61+
RAW_STRING_FLAG,
62+
PARENS_FLAG,
63+
COLON_QUOTE,
64+
TOPLEVEL_SEMICOLONS_FLAG,
65+
MUTABLE_FLAG,
66+
BARE_MODULE_FLAG,
67+
SHORT_FORM_FUNCTION_FLAG
68+
69+
# Syntax trees
70+
@_public is_leaf,
71+
numchildren,
72+
children
73+
1974
export SyntaxNode
2075

76+
@_public GreenNode,
77+
span
78+
2179
# Helper utilities
2280
include("utils.jl")
2381

0 commit comments

Comments
 (0)