Class UtilPrintQuote
java.lang.Object
org.libxmq.imp.UtilQuote
org.libxmq.imp.UtilPrintQuote
Utility for printing xmq quotes.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected intThe maximum number of consecutive double quotes found in the buffer.protected intThe maximum number of consecutive single quotes found in the buffer.protected booleanTrue if the buffer needs a compound marker.protected intThe number of carriage returns found in the buffer.protected intHow many newlines.protected intThe number of tabs found in the buffer.protected booleanTrue if the buffer starts or ends with a double quote.protected booleanTrue if the buffer starts or ends with a single quote.Fields inherited from class UtilQuote
all_leading_, buffer_, buffer_start_, buffer_stop_, debug_, first_ending_nl_, last_indent_, last_leading_nl_, lines_, min_indent_, num_ending_nl_, num_leading_nl_, start_, stop_Modifier and TypeFieldDescriptionprotected booleanSet to true if the quote only consists of newlines and spaces.protected StringWe analyze part of a larger buffer, typically the whole xmq source file.protected intThe buffer_start_ points to where in the larger buffer_ we find the quote to be parsed.protected intThe buffer_stop_ points to just after the quote to be parsed.protected static final booleanDebug flag, currently disabled.protected intStores the index of the first ending newline characters after which lines do not contain non-space characters.protected intWhile looking for the first ending newline, remember the last indent.protected intStores the index of the last leading newline character after which the line contains non-space characters.protected ArrayList<org.libxmq.imp.Line> Stores start,stop,nl for each line found inside a quote.protected intThe minimum indentation found.protected intStores the number of ending newline characters found after the last line with non-space characters.protected intStores the number of leading newline characters found before the first line with non-space characters.protected intStart stores the index either buffer_start_, if no leading newlines are found or start stores the last_leading_nl+1, ie the first character of the first line with non-space characters.protected intStop stores the index either buffer_stop_, if no ending newlines are found or stop stores the first_ending_nl, ie after the end of the last line with non-space characters. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidAnalyzes the buffer for printing.protected StringbuildCompactQuote(int indent) Builds a compact single-line quote.protected StringbuildMultilineQuote(int indent) Builds a multiline quote.static StringrenderQuote(String q, int indent) Renders a quote, possibly multiline, with the given indent.Methods inherited from class UtilQuote
countSame, findEndingNewlines, findLeadingNewlinesModifier and TypeMethodDescriptionprotected intcountSame(int start, int stop) Look at the char at index start and count how many identical chars there are forward.protected voidScans the buffer for trailing newline ('\n') and space (' ') characters.protected voidScans q_ for leading newline ('\n') and space (' ') characters.
-
Field Details
-
num_nl_
protected int num_nl_How many newlines. -
max_num_consecutive_single_quotes_
protected int max_num_consecutive_single_quotes_The maximum number of consecutive single quotes found in the buffer. -
max_num_consecutive_double_quotes_
protected int max_num_consecutive_double_quotes_The maximum number of consecutive double quotes found in the buffer. -
num_cr_
protected int num_cr_The number of carriage returns found in the buffer. -
num_tab_
protected int num_tab_The number of tabs found in the buffer. -
starts_or_ends_with_double_quote_
protected boolean starts_or_ends_with_double_quote_True if the buffer starts or ends with a double quote. -
starts_or_ends_with_single_quote_
protected boolean starts_or_ends_with_single_quote_True if the buffer starts or ends with a single quote. -
needs_compound_
protected boolean needs_compound_True if the buffer needs a compound marker.
-
-
Constructor Details
-
UtilPrintQuote
-
-
Method Details
-
renderQuote
-
buildCompactQuote
Builds a compact single-line quote.- Parameters:
indent- The indent to use.- Returns:
- The compact quote.
-
buildMultilineQuote
Builds a multiline quote.- Parameters:
indent- The indent to use.- Returns:
- The multiline quote.
-
analyzeForPrint
protected void analyzeForPrint()Analyzes the buffer for printing.
-