On branch main
modified: README.md modified: src/ch01.md new file: src/zig.theme new file: src/zig.xml
This commit is contained in:
@@ -8,3 +8,11 @@ by [Karl Seguin](https://github.com/karlseguin) into Russian.
|
||||
|
||||
Distributed under the terms of
|
||||
[Attribution-NonCommercial-ShareAlike 4.0 International](http://creativecommons.org/licenses/by-nc-sa/4.0/)
|
||||
|
||||
# Converting
|
||||
|
||||
## epub
|
||||
|
||||
```
|
||||
pandoc --metadata title="..." --syntax-definition="zig.xml" --highlight-style="zig.theme" ch01.md -o ch01.epub
|
||||
```
|
||||
|
||||
@@ -162,7 +162,7 @@ fn add(a: i64, b: i64) i64 {
|
||||
}
|
||||
```
|
||||
|
||||
Программисты, пишущие на языках C или C++, наверняка заметят, что Zig не
|
||||
Программисты, пишущие на языках C или C++, наверняка заметили, что Zig не
|
||||
требует объявления/определения функции до её использования, функция `add`
|
||||
вызывается раньше (по тексту), чем встречается её определение.
|
||||
|
||||
|
||||
211
src/zig.theme
Normal file
211
src/zig.theme
Normal file
@@ -0,0 +1,211 @@
|
||||
{
|
||||
"text-color": null,
|
||||
"background-color": "#f7f7ff",
|
||||
"line-number-color": "#aaaaaa",
|
||||
"line-number-background-color": null,
|
||||
"text-styles": {
|
||||
"Other": {
|
||||
"text-color": "#007020",
|
||||
"background-color": null,
|
||||
"bold": false,
|
||||
"italic": false,
|
||||
"underline": false
|
||||
},
|
||||
"Attribute": {
|
||||
"text-color": "#7d9029",
|
||||
"background-color": null,
|
||||
"bold": false,
|
||||
"italic": false,
|
||||
"underline": false
|
||||
},
|
||||
"SpecialString": {
|
||||
"text-color": "#bb6688",
|
||||
"background-color": null,
|
||||
"bold": false,
|
||||
"italic": false,
|
||||
"underline": false
|
||||
},
|
||||
"Annotation": {
|
||||
"text-color": "#60a0b0",
|
||||
"background-color": null,
|
||||
"bold": true,
|
||||
"italic": true,
|
||||
"underline": false
|
||||
},
|
||||
"Function": {
|
||||
"text-color": "#06287e",
|
||||
"background-color": null,
|
||||
"bold": false,
|
||||
"italic": false,
|
||||
"underline": false
|
||||
},
|
||||
"String": {
|
||||
"text-color": "#4070a0",
|
||||
"background-color": null,
|
||||
"bold": false,
|
||||
"italic": false,
|
||||
"underline": false
|
||||
},
|
||||
"ControlFlow": {
|
||||
"text-color": "#007020",
|
||||
"background-color": null,
|
||||
"bold": true,
|
||||
"italic": false,
|
||||
"underline": false
|
||||
},
|
||||
"Operator": {
|
||||
"text-color": "#666666",
|
||||
"background-color": null,
|
||||
"bold": false,
|
||||
"italic": false,
|
||||
"underline": false
|
||||
},
|
||||
"Error": {
|
||||
"text-color": "#ff0000",
|
||||
"background-color": null,
|
||||
"bold": true,
|
||||
"italic": false,
|
||||
"underline": false
|
||||
},
|
||||
"BaseN": {
|
||||
"text-color": "#40a070",
|
||||
"background-color": null,
|
||||
"bold": false,
|
||||
"italic": false,
|
||||
"underline": false
|
||||
},
|
||||
"Alert": {
|
||||
"text-color": "#ff0000",
|
||||
"background-color": null,
|
||||
"bold": true,
|
||||
"italic": false,
|
||||
"underline": false
|
||||
},
|
||||
"Variable": {
|
||||
"text-color": "#19177c",
|
||||
"background-color": null,
|
||||
"bold": false,
|
||||
"italic": false,
|
||||
"underline": false
|
||||
},
|
||||
"BuiltIn": {
|
||||
"text-color": "#0000ff",
|
||||
"background-color": null,
|
||||
"bold": false,
|
||||
"italic": false,
|
||||
"underline": false
|
||||
},
|
||||
"Extension": {
|
||||
"text-color": null,
|
||||
"background-color": null,
|
||||
"bold": false,
|
||||
"italic": false,
|
||||
"underline": false
|
||||
},
|
||||
"Preprocessor": {
|
||||
"text-color": "#bc7a00",
|
||||
"background-color": null,
|
||||
"bold": false,
|
||||
"italic": false,
|
||||
"underline": false
|
||||
},
|
||||
"Information": {
|
||||
"text-color": "#60a0b0",
|
||||
"background-color": null,
|
||||
"bold": true,
|
||||
"italic": true,
|
||||
"underline": false
|
||||
},
|
||||
"VerbatimString": {
|
||||
"text-color": "#4070a0",
|
||||
"background-color": null,
|
||||
"bold": false,
|
||||
"italic": false,
|
||||
"underline": false
|
||||
},
|
||||
"Warning": {
|
||||
"text-color": "#60a0b0",
|
||||
"background-color": null,
|
||||
"bold": true,
|
||||
"italic": true,
|
||||
"underline": false
|
||||
},
|
||||
"Documentation": {
|
||||
"text-color": "#ba2121",
|
||||
"background-color": null,
|
||||
"bold": false,
|
||||
"italic": true,
|
||||
"underline": false
|
||||
},
|
||||
"Import": {
|
||||
"text-color": null,
|
||||
"background-color": null,
|
||||
"bold": false,
|
||||
"italic": false,
|
||||
"underline": false
|
||||
},
|
||||
"Char": {
|
||||
"text-color": "#4070a0",
|
||||
"background-color": null,
|
||||
"bold": false,
|
||||
"italic": false,
|
||||
"underline": false
|
||||
},
|
||||
"DataType": {
|
||||
"text-color": "#902000",
|
||||
"background-color": null,
|
||||
"bold": false,
|
||||
"italic": false,
|
||||
"underline": false
|
||||
},
|
||||
"Float": {
|
||||
"text-color": "#40a070",
|
||||
"background-color": null,
|
||||
"bold": false,
|
||||
"italic": false,
|
||||
"underline": false
|
||||
},
|
||||
"Comment": {
|
||||
"text-color": "#60a0b0",
|
||||
"background-color": null,
|
||||
"bold": false,
|
||||
"italic": true,
|
||||
"underline": false
|
||||
},
|
||||
"CommentVar": {
|
||||
"text-color": "#60a0b0",
|
||||
"background-color": null,
|
||||
"bold": true,
|
||||
"italic": true,
|
||||
"underline": false
|
||||
},
|
||||
"Constant": {
|
||||
"text-color": "#880000",
|
||||
"background-color": null,
|
||||
"bold": false,
|
||||
"italic": false,
|
||||
"underline": false
|
||||
},
|
||||
"SpecialChar": {
|
||||
"text-color": "#4070a0",
|
||||
"background-color": null,
|
||||
"bold": false,
|
||||
"italic": false,
|
||||
"underline": false
|
||||
},
|
||||
"DecVal": {
|
||||
"text-color": "#40a070",
|
||||
"background-color": null,
|
||||
"bold": false,
|
||||
"italic": false,
|
||||
"underline": false
|
||||
},
|
||||
"Keyword": {
|
||||
"text-color": "#007020",
|
||||
"background-color": null,
|
||||
"bold": true,
|
||||
"italic": false,
|
||||
"underline": false
|
||||
}
|
||||
}
|
||||
}
|
||||
311
src/zig.xml
Normal file
311
src/zig.xml
Normal file
@@ -0,0 +1,311 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE language [
|
||||
<!ENTITY bin_int "(?:[01]+(?:_[01]+)*)">
|
||||
<!ENTITY oct_int "(?:[0-7]+(?:_[0-7]+)*)">
|
||||
<!ENTITY dec_int "(?:[0-9]+(?:_[0-9]+)*)">
|
||||
<!ENTITY hex_int "(?:[0-9A-Fa-f]+(?:_[0-9A-Fa-f]+)*)">
|
||||
<!ENTITY exp_float "(?:[eE][+-]?&dec_int;)">
|
||||
<!ENTITY exp_hexfloat "(?:[pP][-+]?&dec_int;)">
|
||||
]>
|
||||
<language name="Zig" section="Sources" version="2" kateversion="5.62" indenter="cstyle" extensions="*.zig" mimetype="text/x-zig" priority="1" author="Waqar Ahmed (waqar.17a@gmail.com)" license="MIT">
|
||||
<highlighting>
|
||||
<list name="keywords">
|
||||
<item>addrspace</item>
|
||||
<item>align</item>
|
||||
<item>and</item>
|
||||
<item>anyframe</item>
|
||||
<item>anytype</item>
|
||||
<item>asm</item>
|
||||
<item>callconv</item>
|
||||
<item>enum</item>
|
||||
<item>error</item>
|
||||
<item>export</item>
|
||||
<item>fn</item>
|
||||
<item>inline</item>
|
||||
<item>noalias</item>
|
||||
<item>nosuspend</item>
|
||||
<item>noinline</item>
|
||||
<item>opaque</item>
|
||||
<item>or</item>
|
||||
<item>orelse</item>
|
||||
<item>packed</item>
|
||||
<item>pub</item>
|
||||
<item>resume</item>
|
||||
<item>linksection</item>
|
||||
<item>struct</item>
|
||||
<item>suspend</item>
|
||||
<item>test</item>
|
||||
<item>union</item>
|
||||
<item>unreachable</item>
|
||||
<item>usingnamespace</item>
|
||||
</list>
|
||||
<list name="controlflow">
|
||||
<item>while</item>
|
||||
<item>try</item>
|
||||
<item>switch</item>
|
||||
<item>return</item>
|
||||
<item>for</item>
|
||||
<item>if</item>
|
||||
<item>continue</item>
|
||||
<item>else</item>
|
||||
<item>break</item>
|
||||
<item>catch</item>
|
||||
<item>defer</item>
|
||||
<item>errdefer</item>
|
||||
</list>
|
||||
<list name="types">
|
||||
<item>i8</item>
|
||||
<item>u8</item>
|
||||
<item>i16</item>
|
||||
<item>u16</item>
|
||||
<item>i32</item>
|
||||
<item>u32</item>
|
||||
<item>i64</item>
|
||||
<item>u64</item>
|
||||
<item>i128</item>
|
||||
<item>u128</item>
|
||||
<item>isize</item>
|
||||
<item>usize</item>
|
||||
<item>c_short</item>
|
||||
<item>c_ushort</item>
|
||||
<item>c_int</item>
|
||||
<item>c_uint</item>
|
||||
<item>c_long</item>
|
||||
<item>c_ulong</item>
|
||||
<item>c_longlong</item>
|
||||
<item>c_ulonglong</item>
|
||||
<item>c_longdouble</item>
|
||||
<item>f16</item>
|
||||
<item>f32</item>
|
||||
<item>f64</item>
|
||||
<item>f80</item>
|
||||
<item>f128</item>
|
||||
<item>bool</item>
|
||||
<item>anyopaque</item>
|
||||
<item>void</item>
|
||||
<item>noreturn</item>
|
||||
<item>type</item>
|
||||
<item>anyerror</item>
|
||||
<item>comptime_int</item>
|
||||
<item>comptime_float</item>
|
||||
</list>
|
||||
<list name="modifiers">
|
||||
<item>async</item>
|
||||
<item>await</item>
|
||||
<item>const</item>
|
||||
<item>threadlocal</item>
|
||||
<item>extern</item>
|
||||
<item>allowzero</item>
|
||||
<item>comptime</item>
|
||||
<item>var</item>
|
||||
<item>volatile</item>
|
||||
</list>
|
||||
<list name="literals">
|
||||
<item>false</item>
|
||||
<item>null</item>
|
||||
<item>true</item>
|
||||
<item>undefined</item>
|
||||
</list>
|
||||
<list name="builtin_functions">
|
||||
<item>@addrSpaceCast</item>
|
||||
<item>@addWithOverflow</item>
|
||||
<item>@alignCast</item>
|
||||
<item>@alignOf</item>
|
||||
<item>@as</item>
|
||||
<item>@atomicLoad</item>
|
||||
<item>@atomicRmw</item>
|
||||
<item>@atomicStore</item>
|
||||
<item>@bitCast</item>
|
||||
<item>@bitOffsetOf</item>
|
||||
<item>@boolToInt</item>
|
||||
<item>@bitSizeOf</item>
|
||||
<item>@breakpoint</item>
|
||||
<item>@mulAdd</item>
|
||||
<item>@byteSwap</item>
|
||||
<item>@bitReverse</item>
|
||||
<item>@offsetOf</item>
|
||||
<item>@call</item>
|
||||
<item>@cDefine</item>
|
||||
<item>@cImport</item>
|
||||
<item>@cInclude</item>
|
||||
<item>@clz</item>
|
||||
<item>@cmpxchgStrong</item>
|
||||
<item>@cmpxchgWeak</item>
|
||||
<item>@compileError</item>
|
||||
<item>@compileLog</item>
|
||||
<item>@ctz</item>
|
||||
<item>@cUndef</item>
|
||||
<item>@cVaArg</item>
|
||||
<item>@cVaCopy</item>
|
||||
<item>@cVaEnd</item>
|
||||
<item>@cVaStart</item>
|
||||
<item>@divExact</item>
|
||||
<item>@divFloor</item>
|
||||
<item>@divTrunc</item>
|
||||
<item>@embedFile</item>
|
||||
<item>@enumToInt</item>
|
||||
<item>@errorName</item>
|
||||
<item>@errorReturnTrace</item>
|
||||
<item>@errorToInt</item>
|
||||
<item>@errSetCast</item>
|
||||
<item>@export</item>
|
||||
<item>@extern</item>
|
||||
<item>@fence</item>
|
||||
<item>@field</item>
|
||||
<item>@fieldParentPtr</item>
|
||||
<item>@floatCast</item>
|
||||
<item>@floatToInt</item>
|
||||
<item>@frameAddress</item>
|
||||
<item>@hasDecl</item>
|
||||
<item>@hasField</item>
|
||||
<item>@import</item>
|
||||
<item>@intCast</item>
|
||||
<item>@intToEnum</item>
|
||||
<item>@intToError</item>
|
||||
<item>@intToFloat</item>
|
||||
<item>@intToPtr</item>
|
||||
<item>@max</item>
|
||||
<item>@memcpy</item>
|
||||
<item>@memset</item>
|
||||
<item>@min</item>
|
||||
<item>@wasmMemorySize</item>
|
||||
<item>@wasmMemoryGrow</item>
|
||||
<item>@mod</item>
|
||||
<item>@mulWithOverflow</item>
|
||||
<item>@panic</item>
|
||||
<item>@popCount</item>
|
||||
<item>@prefetch</item>
|
||||
<item>@ptrCast</item>
|
||||
<item>@ptrToInt</item>
|
||||
<item>@rem</item>
|
||||
<item>@returnAddress</item>
|
||||
<item>@select</item>
|
||||
<item>@setAlignStack</item>
|
||||
<item>@setCold</item>
|
||||
<item>@setEvalBranchQuota</item>
|
||||
<item>@setFloatMode</item>
|
||||
<item>@setRuntimeSafety</item>
|
||||
<item>@shlExact</item>
|
||||
<item>@shlWithOverflow</item>
|
||||
<item>@shrExact</item>
|
||||
<item>@shuffle</item>
|
||||
<item>@sizeOf</item>
|
||||
<item>@splat</item>
|
||||
<item>@reduce</item>
|
||||
<item>@src</item>
|
||||
<item>@sqrt</item>
|
||||
<item>@sin</item>
|
||||
<item>@cos</item>
|
||||
<item>@tan</item>
|
||||
<item>@exp</item>
|
||||
<item>@exp2</item>
|
||||
<item>@log</item>
|
||||
<item>@log2</item>
|
||||
<item>@log10</item>
|
||||
<item>@fabs</item>
|
||||
<item>@floor</item>
|
||||
<item>@ceil</item>
|
||||
<item>@trunc</item>
|
||||
<item>@round</item>
|
||||
<item>@subWithOverflow</item>
|
||||
<item>@tagName</item>
|
||||
<item>@This</item>
|
||||
<item>@truncate</item>
|
||||
<item>@Type</item>
|
||||
<item>@typeInfo</item>
|
||||
<item>@typeName</item>
|
||||
<item>@TypeOf</item>
|
||||
<item>@unionInit</item>
|
||||
<item>@Vector</item>
|
||||
</list>
|
||||
<contexts>
|
||||
<context attribute="Normal Text" lineEndContext="#stay" name="Normal">
|
||||
<DetectSpaces/>
|
||||
<Detect2Chars char="/" char1="/" attribute="Comment" context="Comment"/>
|
||||
<AnyChar attribute="Symbol" context="#stay" String=":!%&+,-/.*<=>?|~^"/>
|
||||
<AnyChar context="Number" String="0123456789" lookAhead="1"/>
|
||||
<DetectChar attribute="String" context="DoubleQuoteString" char="""/>
|
||||
<DetectChar attribute="Character" context="SingleQuoteString" char="'"/>
|
||||
<Detect2Chars char="\" char1="\" attribute="String" context="Multiline String"/>
|
||||
<keyword String="keywords" attribute="Keyword" context="#stay"/>
|
||||
<keyword String="types" attribute="Type" context="#stay"/>
|
||||
<keyword String="literals" attribute="Constant" context="#stay" />
|
||||
<keyword String="builtin_functions" attribute="Builtin Functions" context="#stay" />
|
||||
<keyword String="controlflow" attribute="Control Flow" context="#stay" />
|
||||
<keyword String="modifiers" attribute="Modifiers" context="#stay" />
|
||||
<WordDetect attribute="Self Variable" String="self"/>
|
||||
<!-- <AnyChar context="SpecialType" String="iu" lookAhead="1"/> -->
|
||||
<DetectIdentifier/>
|
||||
</context>
|
||||
<!-- Strings -->
|
||||
<context attribute="String" lineEndContext="#pop" name="DoubleQuoteString">
|
||||
<DetectChar context="EscapeChar" char="\" lookAhead="1"/>
|
||||
<DetectChar attribute="String" context="#pop" char="""/>
|
||||
</context>
|
||||
<context attribute="Character" lineEndContext="#pop" name="SingleQuoteString">
|
||||
<DetectChar context="EscapeChar" char="\" lookAhead="1"/>
|
||||
<DetectChar attribute="Character" context="#pop" char="'"/>
|
||||
</context>
|
||||
<context attribute="String" lineEndContext="#pop" name="Multiline String"/>
|
||||
<context attribute="String Char" lineEndContext="#pop" name="EscapeChar">
|
||||
<RegExpr attribute="String Char" context="#pop" String="\\([nrt'"\\]|x[0-9a-fA-F]{2}|u\{[0-9a-fA-F]+\})"/>
|
||||
<RegExpr attribute="Error" context="#pop" String="\\(x[0-9a-fA-F]?|u\{[0-9a-fA-F]{0,8}\}?)?"/>
|
||||
</context>
|
||||
<!-- Comment -->
|
||||
<context attribute="Comment" lineEndContext="#pop" name="Comment">
|
||||
<DetectSpaces attribute="Comment"/>
|
||||
<!-- IncludeRules context="##Comments"/ -->
|
||||
<DetectIdentifier attribute="Comment"/>
|
||||
</context>
|
||||
<!-- Integer / Float -->
|
||||
<context name="Number" attribute="Normal Text" lineEndContext="#pop">
|
||||
<RegExpr attribute="Float" context="#pop!SuffixNumber" String="&dec_int;(\.&dec_int;&exp_float;?|&exp_float;)"/>
|
||||
<RegExpr attribute="Decimal" context="#pop!SuffixNumber" String="0(?=[^xob]|$)|(?=0[xob])|&dec_int;"/>
|
||||
<RegExpr attribute="Hex Float" context="#pop!SuffixNumber" String="0x&hex_int;(\.&hex_int;&exp_hexfloat;?|&exp_hexfloat;)"/>
|
||||
<RegExpr attribute="Hex" context="#pop!SuffixNumber" String="0x&hex_int;"/>
|
||||
<RegExpr attribute="Octal" context="#pop!SuffixNumber" String="0o&oct_int;"/>
|
||||
<RegExpr attribute="Binary" context="#pop!SuffixNumber" String="0b&bin_int;"/>
|
||||
<DetectChar attribute="Decimal" context="#pop!SuffixNumber" char="0"/>
|
||||
</context>
|
||||
<context name="SuffixNumber" attribute="Normal Text" lineEndContext="#pop" fallthroughContext="#pop">
|
||||
<AnyChar attribute="Error" String=".0123456789" context="#pop"/>
|
||||
<DetectIdentifier attribute="Error" context="#pop"/>
|
||||
</context>
|
||||
<!-- Integer type -->
|
||||
<!-- i or u followed by digits. The maximum allowed bit-width of an integer type is 65535 -->
|
||||
<!--<context name="SpecialType" attribute="Normal Text" lineEndContext="#pop">
|
||||
<RegExpr attribute="Type" context="#pop" String="\b[ui]([0-9]{1,4}|[1-5][0-9]{4}|6([0-4][0-9]{3}|5([0-4][0-9]{2}|5([0-2][0-9]|3[0-5]))))\b"/>
|
||||
<DetectIdentifier attribute="Normal Text" context="#pop"/>
|
||||
</context>-->
|
||||
</contexts>
|
||||
<itemDatas>
|
||||
<itemData name="Normal Text" defStyleNum="dsNormal"/>
|
||||
<itemData name="Self Variable" defStyleNum="dsVariable" spellChecking="false"/>
|
||||
<itemData name="Keyword" defStyleNum="dsKeyword" spellChecking="false"/>
|
||||
<itemData name="Type" defStyleNum="dsDataType" spellChecking="false"/>
|
||||
<itemData name="Builtin Functions" defStyleNum="dsBuiltIn" spellChecking="false"/>
|
||||
<itemData name="Constant" defStyleNum="dsConstant" spellChecking="false"/>
|
||||
<itemData name="Control Flow" defStyleNum="dsControlFlow" spellChecking="false"/>
|
||||
<itemData name="Modifiers" defStyleNum="dsAttribute" spellChecking="false"/>
|
||||
<itemData name="Comment" defStyleNum="dsComment" spellChecking="true"/>
|
||||
<itemData name="Binary" defStyleNum="dsBaseN" spellChecking="false"/>
|
||||
<itemData name="Octal" defStyleNum="dsBaseN" spellChecking="false"/>
|
||||
<itemData name="Hex" defStyleNum="dsBaseN" spellChecking="false"/>
|
||||
<itemData name="Decimal" defStyleNum="dsDecVal" spellChecking="false"/>
|
||||
<itemData name="Float" defStyleNum="dsFloat" spellChecking="false"/>
|
||||
<itemData name="Hex Float" defStyleNum="dsFloat" spellChecking="false"/>
|
||||
<itemData name="String" defStyleNum="dsString"/>
|
||||
<itemData name="String Char" defStyleNum="dsSpecialChar"/>
|
||||
<itemData name="Character" defStyleNum="dsChar" spellChecking="false"/>
|
||||
<itemData name="Symbol" defStyleNum="dsOperator" spellChecking="false"/>
|
||||
<itemData name="Error" defStyleNum="dsError" spellChecking="false"/>
|
||||
</itemDatas>
|
||||
</highlighting>
|
||||
<general>
|
||||
<comments>
|
||||
<comment name="singleLine" start="//" position="afterwhitespace"/>
|
||||
</comments>
|
||||
<keywords casesensitive="true"/>
|
||||
</general>
|
||||
</language>
|
||||
<!-- kate: replace-tabs on; tab-width 4; indent-width 4; -->
|
||||
Reference in New Issue
Block a user