📄 quickbook.qbk
字号:
def_macro =
"def" >> hard_space
>> identifier
>> blank >> phrase
;
table =
"table" >> hard_space
>> (*(anychar_p - eol))
>> +eol
>> *table_row
>> eps_p
;
table_row =
space
>> ch_p('[')
>>
(
(
*table_cell
>> ch_p(']')
>> space
)
| eps_p
)
;
table_cell =
space
>> ch_p('[')
>>
(
(
phrase
>> ch_p(']')
>> space
)
| eps_p
)
;
variablelist =
"variablelist" >> hard_space
>> (*(anychar_p - eol))
>> +eol
>> *varlistentry
>> eps_p
;
varlistentry =
space
>> ch_p('[')
>>
(
(
varlistterm
>> +varlistitem
>> ch_p(']')
>> space
)
| eps_p
)
;
varlistterm =
space
>> ch_p('[')
>>
(
(
phrase
>> ch_p(']')
>> space
)
| eps_p
)
;
varlistitem =
space
>> ch_p('[')
>>
(
(
phrase
>> ch_p(']')
>> space
)
| eps_p
)
;
xinclude =
"xinclude"
>> hard_space
>> (*(anychar_p -
close_bracket))
;
identifier =
*(anychar_p - (space_p | ']'))
;
source_mode =
(
str_p("c++")
| "python"
)
;
code =
(
code_line
>> *(*eol >> code_line)
)
>> +eol
;
code_line =
((ch_p(' ') | '\t'))
>> *(anychar_p - eol) >> eol
;
list =
eps_p(ch_p('*') | '#') >>
+(
(*blank_p
>> (ch_p('*') | '#'))
>> *blank_p
>> list_item
)
;
list_item =
*( common
| (anychar_p -
( eol_p >> *blank_p >> eps_p(ch_p('*') | '#')
| (eol >> eol)
)
)
)
>> +eol
;
common =
self.actions.macro
| phrase_markup
| inline_code
| simple_format
| escape
| comment
;
inline_code =
'`' >>
(
*(anychar_p -
( '`'
| (eol >> eol) // Make sure that we don't go
) // past a single block
) >> eps_p('`')
)
>> '`'
;
simple_format =
simple_bold
| simple_italic
| simple_underline
| simple_teletype
;
simple_bold =
'*' >>
(
( graph_p >> // graph_p must follow '*'
*(anychar_p -
( eol // Make sure that we don't go
| (graph_p >> '*') // past a single line
)
) >> graph_p // graph_p must precede '*'
>> eps_p('*'
>> (space_p | punct_p)) // space_p or punct_p must
) // follow '*'
| (
graph_p // A single char. e.g. *c*
>> eps_p('*'
>> (space_p | punct_p))
)
)
>> '*'
;
simple_italic =
'/' >>
(
( graph_p >> // graph_p must follow '/'
*(anychar_p -
( eol // Make sure that we don't go
| (graph_p >> '/') // past a single line
)
) >> graph_p // graph_p must precede '/'
>> eps_p('/'
>> (space_p | punct_p)) // space_p or punct_p must
) // follow '/'
| (
graph_p // A single char. e.g. /c/
>> eps_p('/'
>> (space_p | punct_p))
)
)
>> '/'
;
simple_underline =
'_' >>
(
( graph_p >> // graph_p must follow '_'
*(anychar_p -
( eol // Make sure that we don't go
| (graph_p >> '_') // past a single line
)
) >> graph_p // graph_p must precede '_'
>> eps_p('_'
>> (space_p | punct_p)) // space_p or punct_p must
) // follow '_'
| (
graph_p // A single char. e.g. _c_
>> eps_p('_'
>> (space_p | punct_p))
)
)
>> '_'
;
simple_teletype =
'=' >>
(
( graph_p >> // graph_p must follow '='
*(anychar_p -
( eol // Make sure that we don't go
| (graph_p >> '=') // past a single line
)
) >> graph_p // graph_p must precede '='
>> eps_p('='
>> (space_p | punct_p)) // space_p or punct_p must
) // follow '='
| (
graph_p // A single char. e.g. =c=
>> eps_p('='
>> (space_p | punct_p))
)
)
>> '='
;
paragraph =
*( common
| (anychar_p - // Make sure we don't go past
(eol >> eol) // a single block.
)
)
>> +eol
;
phrase =
*( common
| comment
| (anychar_p -
close_bracket)
)
;
phrase_markup =
'['
>> ( image
| url
| link
| anchor
| source_mode
| funcref
| classref
| memberref
| enumref
| headerref
| bold
| italic
| underline
| teletype
| str_p("br")
)
>> ']'
;
escape =
str_p("\\n")
| '\\' >> punct_p
| (
"'''" >> !eol
>> *(anychar_p - "'''")
>> "'''"
)
;
image =
'$' >> blank
>> (*(anychar_p -
close_bracket))
;
url =
'@'
>> (*(anychar_p -
(']' | hard_space)))
>> ( eps_p(']')
| (hard_space >> phrase)
)
;
link =
"link" >> hard_space
>> (*(anychar_p -
(']' | hard_space)))
>> ( eps_p(']')
| (hard_space >> phrase)
)
;
anchor =
'#'
>> blank
>> ( *(anychar_p -
close_bracket)
)
;
funcref =
"funcref" >> hard_space
>> (*(anychar_p -
(']' | hard_space)))
>> ( eps_p(']')
| (hard_space >> phrase)
)
;
classref =
"classref" >> hard_space
>> (*(anychar_p -
(']' | hard_space)))
>> ( eps_p(']')
| (hard_space >> phrase)
)
;
memberref =
"memberref" >> hard_space
>> (*(anychar_p -
(']' | hard_space)))
>> ( eps_p(']')
| (hard_space >> phrase)
)
;
enumref =
"enumref" >> hard_space
>> (*(anychar_p -
(']' | hard_space)))
>> ( eps_p(']')
| (hard_space >> phrase)
)
;
headerref =
"headerref" >> hard_space
>> (*(anychar_p -
(']' | hard_space)))
>> ( eps_p(']')
| (hard_space >> phrase)
)
;
bold =
ch_p('*')
>> blank >> phrase
;
italic =
ch_p('\'')
>> blank >> phrase
;
underline =
ch_p('_')
>> blank >> phrase
;
teletype =
ch_p('^')
>> blank >> phrase
;
[endsect]
[section:highlight C++ Syntax Highlighting Grammar]
program
=
*( macro
| preprocessor
| comment
| keyword
| identifier
| special
| string_
| char_
| number
| space_p
| anychar_p
)
;
macro
= *space_p >> self.macro
;
preprocessor
= *space_p >> '#' >> ((alpha_p | '_') >> *(alnum_p | '_'))
;
comment
= +(*space_p >> (comment_p("//") | comment_p("/*", "*/")))
;
keyword
= *space_p >> keyword_ >> (eps_p - (alnum_p | '_'))
; // make sure we recognize whole words only
keyword_
= "and_eq", "and", "asm", "auto", "bitand", "bitor",
"bool", "break", "case", "catch", "char", "class",
"compl", "const_cast", "const", "continue", "default",
"delete", "do", "double", "dynamic_cast", "else",
"enum", "explicit", "export", "extern", "false",
"float", "for", "friend", "goto", "if", "inline",
"int", "long", "mutable", "namespace", "new", "not_eq",
"not", "operator", "or_eq", "or", "private",
"protected", "public", "register", "reinterpret_cast",
"return", "short", "signed", "sizeof", "static",
"static_cast", "struct", "switch", "template", "this",
"throw", "true", "try", "typedef", "typeid",
"typename", "union", "unsigned", "using", "virtual",
"void", "volatile", "wchar_t", "while", "xor_eq", "xor"
;
special
= *space_p >> +chset_p("~!%^&*()+={[}]:;,<.>?/|\\-")
;
string_
= *space_p >> !as_lower_d['l'] >> confix_p('"', *c_escape_ch_p, '"')
;
char_
= *space_p >> !as_lower_d['l'] >> confix_p('\'', *c_escape_ch_p, '\'')
;
number
= *space_p >>
( as_lower_d["0x"] >> hex_p
| '0' >> oct_p
| real_p
)
>> *as_lower_d[chset_p("ldfu")]
;
identifier
= *space_p >> ((alpha_p | '_') >> *(alnum_p | '_'))
;
[endsect]
[section:pyhighlight Python Syntax Highlighting Grammar]
[c++]
program
=
*( macro
| comment
| keyword
| identifier
| special
| string_
| number
| space_p
| anychar_p
)
;
macro
= *space_p >> self.macro
;
comment
= +(*space_p >> comment_p("#"))
;
keyword
= *space_p >> keyword_ >> (eps_p - (alnum_p | '_'))
; // make sure we recognize whole words only
keyword_
=
"and", "del", "for", "is", "raise",
"assert", "elif", "from", "lambda", "return",
"break", "else", "global", "not", "try",
"class", "except", "if", "or", "while",
"continue", "exec", "import", "pass", "yield",
"def", "finally", "in", "print",
// Technically "as" and "None" are not yet keywords (at Python
// 2.4). They are destined to become keywords, and we treat them
// as such for syntax highlighting purposes.
"as", "None"
;
special
= *space_p >> +chset_p("~!%^&*()+={[}]:;,<.>/|\\-")
;
string_prefix
= as_lower_d[str_p("u") >> ! str_p("r")]
;
string_
= *space_p >> ! string_prefix >> (long_string | short_string)
;
short_string
= confix_p('"', * c_escape_ch_p, '"') |
confix_p('\'', * c_escape_ch_p, '\'')
;
long_string
= confix_p("'''", * lex_escape_ch_p, "'''") |
confix_p("\"\"\"", * lex_escape_ch_p, "\"\"\"")
;
number
= *space_p >>
(
as_lower_d["0x"] >> hex_p
| '0' >> oct_p
| real_p
)
>> *as_lower_d[chset_p("lj")]
;
identifier
= *space_p >> ((alpha_p | '_') >> *(alnum_p | '_'))
;
[endsect]
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -