Skip to content

Commit

Permalink
Mark public symbols with public keyword
Browse files Browse the repository at this point in the history
  • Loading branch information
c42f committed Aug 7, 2024
1 parent 784aa8c commit 57c8c3c
Showing 1 changed file with 70 additions and 13 deletions.
83 changes: 70 additions & 13 deletions src/JuliaSyntax.jl
Original file line number Diff line number Diff line change
@@ -1,23 +1,80 @@
module JuliaSyntax

# Conservative list of exports - only export the most common/useful things
# here.
macro _public(syms)
if VERSION >= v"1.11"
names = syms isa Symbol ? [syms] : syms.args
esc(Expr(:public, names...))
else
nothing
end
end

# Public API, in the order of docs/src/api.md

# Parsing.
export parsestmt,
parseall,
parseatom

@_public parse!,
ParseStream,
build_tree

# Parsing. See also
# parse!(), ParseStream
export parsestmt, parseall, parseatom
# Tokenization
export tokenize, Token, untokenize
# Source file handling. See also
# highlight() sourcetext() source_line() source_location()
@_public tokenize,
Token,
untokenize

# Source file handling
@_public sourcefile,
byte_range,
first_byte,
last_byte,
filename,
source_line,
source_location,
sourcetext,
highlight

export SourceFile
# Expression heads/kinds. See also
# flags() and related predicates.
export @K_str, kind, head
# Syntax tree types. See also
# GreenNode
@_public source_line_range

# Expression predicates, kinds and flags
export @K_str, kind
@_public Kind

@_public flags,
SyntaxHead,
head,
is_trivia,
is_prefix_call,
is_infix_op_call,
is_prefix_op_call,
is_postfix_op_call,
is_dotted,
is_suffixed,
is_decorated,
numeric_flags,
has_flags,
TRIPLE_STRING_FLAG,
RAW_STRING_FLAG,
PARENS_FLAG,
COLON_QUOTE,
TOPLEVEL_SEMICOLONS_FLAG,
MUTABLE_FLAG,
BARE_MODULE_FLAG,
SHORT_FORM_FUNCTION_FLAG

# Syntax trees
@_public is_leaf,
numchildren,
children

export SyntaxNode

@_public GreenNode,
span

# Helper utilities
include("utils.jl")

Expand Down

0 comments on commit 57c8c3c

Please sign in to comment.