BetweenFlags API Documentation

BetweenFlags.FlagType
Flag(flag::String,
     flag_boundaries_left::Vector{String},
     flag_boundaries_right::Vector{String})

A flag that BetweenFlags looks for to denote the start/stop position of a given scope. The flag boundaries need only be unique since every permutation of left and right flag boundaries are taken to determine scopes.

julia>
using BetweenFlags
# find: ["\nfunction", " function", ";function"]
start_flag = Flag("function",
                  ["\n", "\s", ";"],
                  ["\n", "\s"],
                  StartType())
# find: ["\nend", " end", ";end"]
stop_flag = Flag("end",
                 ["\n", "\s", ";"],
                 ["\n", "\s", ";"],
                 StopType())
BetweenFlags.FlagPairType
FlagPair(start::Flag, stop::Flag)

A flag pair that defines the start and stop of the substring of interest.

julia>
using BetweenFlags
# find: ["\nfunction", " function", ";function"]
start_flag = Flag("function",
                  ["\n", "\s", ";"],
                  ["\n", "\s"],
                  StartType())
# find: ["\nend", " end", ";end"]
stop_flag = Flag("end",
                 ["\n", "\s", ";"],
                 ["\n", "\s", ";"],
                 StopType())
flag_pair = FlagPair(start_flag, stop_flag)
BetweenFlags.TokenStreamType
TokenStream

A token stream, containing

  • flag_set a FlagSet
  • code a string of code to be tokenized
  • token_stream a token stream (dict) whose keys are the flag IDs, and whose values are vectors of Ints indicating the nestedness of the flag.