Package hydra.print.emacs
Interface Regex
-
public interface RegexPer-dialect printer rendering the hydra.regex AST into GNU Emacs regexp syntax. Emacs inverts several escaping conventions relative to POSIX ERE (probe-verified, Emacs 28.2): alternation is \| (bare | is literal), grouping is \( \) (bare ( ) are literal), and bounded quantifiers are \{n,m\} (bare braces are literal). The quantifiers * + ? are bare as usual, and character classes are POSIX-like. Hydra's . (any incl. newline) renders as [^z-a] — an empty negated range that matches every character including newline (Emacs . excludes newline). See docs/specification/regex.md and issue #567.
-
-
Method Summary
Static Methods Modifier and Type Method Description static java.lang.Stringalternation(java.util.List<java.util.List<Quantified>> alt)Render an alternation, joining its branches with Emacs's \| operator.static java.lang.StringanyClass()The Emacs rendering of Hydra's .static java.lang.Stringatom(Atom a)Render a single atom; .static java.lang.StringcharacterClass(CharacterClass cc)Render a character class, including the leading ^ for a negated class (POSIX-like in Emacs).static java.lang.StringclassItem(ClassItem item)Render one character-class member (a single character or an inclusive range).static java.lang.StringescapeClassChar(java.lang.Integer c)Render a code point inside a character class, uniformly escaping the class metacharacters \ ] ^ -.static java.lang.StringescapeLiteral(java.lang.Integer c)Render a literal code point in top-level context under Emacs regexp, escaping only the characters that are special bare in Emacs: .static java.lang.StringprintCodePoint(java.lang.Integer c)Render a single Unicode code point as a one-character string.static java.lang.StringprintRegex(java.util.List<java.util.List<Quantified>> r)Render a hydra.regex AST into GNU Emacs regexp syntax (escaped \| \( \) \{..\}, .static java.lang.Stringquantified(Quantified qa)Render an atom followed by its quantifier suffix.static java.lang.Stringquantifier(Quantifier q)Render a quantifier suffix; bounded {..} forms use Emacs's escaped braces \{..\}.static java.lang.StringregexSequence(java.util.List<Quantified> s)Render a sequence of quantified atoms by concatenation.
-
-
-
Method Detail
-
alternation
static java.lang.String alternation(java.util.List<java.util.List<Quantified>> alt)
Render an alternation, joining its branches with Emacs's \| operator.
-
anyClass
static java.lang.String anyClass()
The Emacs rendering of Hydra's . (any character incl. newline): the empty-negated-range [^z-a].
-
atom
static java.lang.String atom(Atom a)
Render a single atom; . -> [^z-a], and groups use Emacs's \( \) escaping.
-
characterClass
static java.lang.String characterClass(CharacterClass cc)
Render a character class, including the leading ^ for a negated class (POSIX-like in Emacs).
-
classItem
static java.lang.String classItem(ClassItem item)
Render one character-class member (a single character or an inclusive range).
-
escapeClassChar
static java.lang.String escapeClassChar(java.lang.Integer c)
Render a code point inside a character class, uniformly escaping the class metacharacters \ ] ^ -.
-
escapeLiteral
static java.lang.String escapeLiteral(java.lang.Integer c)
Render a literal code point in top-level context under Emacs regexp, escaping only the characters that are special bare in Emacs: . * + ? [ ] ^ $ \. Note | ( ) { } are literal in Emacs and are NOT escaped here.
-
printCodePoint
static java.lang.String printCodePoint(java.lang.Integer c)
Render a single Unicode code point as a one-character string.
-
printRegex
static java.lang.String printRegex(java.util.List<java.util.List<Quantified>> r)
Render a hydra.regex AST into GNU Emacs regexp syntax (escaped \| \( \) \{..\}, . as [^z-a]).
-
quantified
static java.lang.String quantified(Quantified qa)
Render an atom followed by its quantifier suffix.
-
quantifier
static java.lang.String quantifier(Quantifier q)
Render a quantifier suffix; bounded {..} forms use Emacs's escaped braces \{..\}.
-
regexSequence
static java.lang.String regexSequence(java.util.List<Quantified> s)
Render a sequence of quantified atoms by concatenation.
-
-