mirror of
https://github.com/zap-proto/cpp-core.git
synced 2026-10-30 15:06:00 +00:00
Build system (autotools/CMake/Bazel) capnp->zap rebrand completed so the
c++/ tree configures cleanly: `autoreconf -i && ./configure` succeeds,
emitting Makefile, all zap*.pc / kj*.pc and the Zap CMake config. configure.ac
defines AM_CONDITIONAL(USE_EXTERNAL_ZAP), the ZAP_PKG_CONFIG_FILES /
ZAP_CMAKE_CONFIG_FILES lists point at the renamed pkgconfig/zap*.pc.in and
cmake/Zap*.cmake.in, and Makefile.am's `if USE_EXTERNAL_ZAP` matches. Bazel
loads @zap-cpp//src/zap:cc_zap_library.bzl. Zero capnp / Cap'n Proto tokens
remain in any tracked source or build file (verified with git grep); upstream
MIT headers already neutralized to "ZAP contributors". quick-test.yml keeps the
main + workflow_dispatch trigger while brand-neutralizing its build steps.
Whitespace-significant schema desugar (compiler/desugar.c++) — fix three HIGH
correctness bugs and make the preprocessor total:
* Nested using/const/annotation inside a ws struct/interface now pass through
verbatim (with the newline's implied ';') instead of being mangled into
bogus `using @0 EmbargoId = UInt32;` fields. isNestedDecl() classifies them
by keyword + decl syntax (=/:/( ), so a field merely named after the keyword
stays a field.
* Ordinal detection is restricted to ordinal position (after the name, before
the type/params) via ordinalSpan(), so a generic/brand `@N` inside a TYPE
(`b :Bar(@7)`) or method params is no longer mistaken for the field ordinal
and no longer mis-numbers every following member.
* Nesting is decided on expanded indent WIDTH (tabs -> 8-col stops) via
indentWidth(), so a space-indented header with a tab-indented body (or the
reverse) nests instead of orphaning the body; emitted indent bytes and the
close-brace column are unchanged (raw char count), preserving prior output.
* Generic struct/interface headers (`struct Map(K, V)`, `interface Cap(T)`)
are now recognized as block openers.
* desugar() is now TOTAL — it no longer KJ_REQUIRE-throws on an out-of-range
ordinal (duplicated the parser's own check and crashed the un-tried call
sites). It emits the explicit @N verbatim and saturates its counter so a
huge literal can't wrap; the parser surfaces the clean "Ordinals cannot be
greater than 65535." diagnostic at the right file:line:col. Removed the now
redundant validateAutoOrdinal and the dead kj/debug.h include. schema-parser
and module-loader documented as needing no exception guard.
desugar-test.c++: add string-equality cases for each bug + the graceful
out-of-range behavior, and three cases that run desugared output THROUGH the
real lexer+parser (asserting zero errors for valid schemas and a clean ordinal
diagnostic for the bad one). Brace back-compat proven byte-identical over the
18-file corpus; sample.ws.zap still desugars to sample.brace.zap exactly.
133 lines
6.9 KiB
XML
133 lines
6.9 KiB
XML
<?xml version="1.0" encoding="UTF-8"?>
|
|
<!DOCTYPE language SYSTEM "language.dtd">
|
|
|
|
<!-- Syntax highlighting for Kate and QtCreator. To customize colors, see end of file. -->
|
|
|
|
<language name="Zap" version="0.5" kateversion="2.4" section="Sources" extensions="*.zap" mimetype="text/x-zap" license="BSD 2-clause" author="Kenton Varda ([email protected])">
|
|
<highlighting>
|
|
<list name="keyword">
|
|
<item>struct</item>
|
|
<item>enum</item>
|
|
<item>interface</item>
|
|
<item>union</item>
|
|
<item>import</item>
|
|
<item>using</item>
|
|
<item>const</item>
|
|
<item>annotation</item>
|
|
<item>extends</item>
|
|
<item>in</item>
|
|
<item>of</item>
|
|
<item>on</item>
|
|
<item>as</item>
|
|
<item>with</item>
|
|
<item>from</item>
|
|
<item>fixed</item>
|
|
</list>
|
|
<list name="type">
|
|
<item>union</item>
|
|
<item>group</item>
|
|
<item>Void</item>
|
|
<item>Bool</item>
|
|
<item>Int8</item>
|
|
<item>Int16</item>
|
|
<item>Int32</item>
|
|
<item>Int64</item>
|
|
<item>UInt8</item>
|
|
<item>UInt16</item>
|
|
<item>UInt32</item>
|
|
<item>UInt64</item>
|
|
<item>Float32</item>
|
|
<item>Float64</item>
|
|
<item>Text</item>
|
|
<item>Data</item>
|
|
<item>AnyPointer</item>
|
|
<item>AnyStruct</item>
|
|
<item>Capability</item>
|
|
<item>List</item>
|
|
</list>
|
|
<contexts>
|
|
<context name="Normal" attribute="Normal" lineEndContext="#stay">
|
|
<DetectChar attribute="Comment" context="Comment" char="#"/>
|
|
<RegExpr attribute="Id" context="#stay" String="@(0x[0-9a-fA-F]+|[0-9]+)\b"/>
|
|
<DetectChar attribute="Value" context="Value" char="="/>
|
|
<DetectChar attribute="Type" context="Type" char=":"/>
|
|
<DetectChar attribute="Annotation" context="Annotation" char="$"/>
|
|
<keyword String="keyword" context="#stay" attribute="Keyword" />
|
|
<DetectChar attribute="Symbol" context="#stay" char="{" beginRegion="Brace1"/>
|
|
<DetectChar attribute="Symbol" context="#stay" char="}" endRegion="Brace1"/>
|
|
<AnyChar attribute="Symbol" context="#stay" String="!%&*+-./<=>?^|~;[]()"/>
|
|
</context>
|
|
<context name="Comment" attribute="Comment" lineEndContext="#pop"></context>
|
|
<context name="Value" attribute="Value" lineEndContext="#stay">
|
|
<DetectChar attribute="Comment" context="Comment" char="#"/>
|
|
<AnyChar attribute="Value" context="ParenValue" String="(["/>
|
|
<RegExpr attribute="Value" context="#stay" String=""([^"\\]|\\.)*""/>
|
|
<RegExpr attribute="Value" context="#stay" String="'([^'\\]|\\.)*'"/>
|
|
<AnyChar attribute="Symbol" context="#pop" String="{};:=$)," lookAhead="true"/>
|
|
</context>
|
|
<context name="ParenValue" attribute="Value" lineEndContext="#stay">
|
|
<DetectChar attribute="Comment" context="Comment" char="#"/>
|
|
<AnyChar attribute="Value" context="ParenValue" String="(["/>
|
|
<AnyChar attribute="Value" context="#pop" String=")]"/>
|
|
<AnyChar attribute="Symbol" context="#pop" String="{};" lookAhead="true"/>
|
|
<RegExpr attribute="Value" context="#stay" String=""([^"\\]|\\.)*""/>
|
|
<RegExpr attribute="Value" context="#stay" String="'([^'\\]|\\.)*'"/>
|
|
</context>
|
|
<context name="Type" attribute="Type" lineEndContext="#stay">
|
|
<DetectChar attribute="Comment" context="Comment" char="#"/>
|
|
<AnyChar attribute="Type" context="ParenType" String="(["/>
|
|
<keyword String="type" context="#stay" attribute="KeyType" />
|
|
<RegExpr attribute="Type" context="#stay" String=""([^"\\]|\\.)*""/>
|
|
<RegExpr attribute="Type" context="#stay" String="'([^'\\]|\\.)*'"/>
|
|
<AnyChar attribute="Symbol" context="#pop" String="{};:=$)," lookAhead="true"/>
|
|
</context>
|
|
<context name="ParenType" attribute="Type" lineEndContext="#stay">
|
|
<DetectChar attribute="Comment" context="Comment" char="#"/>
|
|
<AnyChar attribute="Type" context="ParenType" String="(["/>
|
|
<AnyChar attribute="Type" context="#pop" String=")]"/>
|
|
<keyword String="type" context="#stay" attribute="KeyType" />
|
|
<AnyChar attribute="Symbol" context="#pop" String="{};" lookAhead="true"/>
|
|
<RegExpr attribute="Type" context="#stay" String=""([^"\\]|\\.)*""/>
|
|
<RegExpr attribute="Type" context="#stay" String="'([^'\\]|\\.)*'"/>
|
|
</context>
|
|
<context name="Annotation" attribute="Annotation" lineEndContext="#stay">
|
|
<DetectChar attribute="Comment" context="Comment" char="#"/>
|
|
<AnyChar attribute="Annotation" context="ParenAnnotation" String="(["/>
|
|
<RegExpr attribute="Annotation" context="#stay" String=""([^"\\]|\\.)*""/>
|
|
<RegExpr attribute="Annotation" context="#stay" String="'([^'\\]|\\.)*'"/>
|
|
<AnyChar attribute="Symbol" context="#pop" String="{};:=$)," lookAhead="true"/>
|
|
</context>
|
|
<context name="ParenAnnotation" attribute="Annotation" lineEndContext="#stay">
|
|
<DetectChar attribute="Comment" context="Comment" char="#"/>
|
|
<AnyChar attribute="Annotation" context="ParenAnnotation" String="(["/>
|
|
<AnyChar attribute="Annotation" context="#pop" String=")]"/>
|
|
<AnyChar attribute="Symbol" context="#pop" String="{};" lookAhead="true"/>
|
|
<RegExpr attribute="Annotation" context="#stay" String=""([^"\\]|\\.)*""/>
|
|
<RegExpr attribute="Annotation" context="#stay" String="'([^'\\]|\\.)*'"/>
|
|
</context>
|
|
</contexts>
|
|
<itemDatas>
|
|
<!-- Since my highlighting approach is different from most programming languages, the contexts
|
|
don't fit nicely into the standard set, so I have to define colors explicitly. A couple
|
|
of these, like "keyword" and "type", could be mapped to dsKeyword and dsDataType, but
|
|
there's a chance the user has mapped the colors for those things to things that would
|
|
conflict with the manually-defined colors here, which would probably be even more annoying
|
|
than having the colors be inconsistent from other languages. So, I use manual colors for
|
|
everything, except comments, which I figure are less likely to have this problem. -->
|
|
<itemData name="Normal" defStyleNum="dsNormal"/>
|
|
<itemData name="Keyword" defStyleNum="dsOthers" color="#000099" bold="1"/>
|
|
<itemData name="Id" defStyleNum="dsOthers" color="#0099FF"/>
|
|
<itemData name="Annotation" defStyleNum="dsOthers" color="#999900"/>
|
|
<itemData name="Type" defStyleNum="dsOthers" color="#009900"/>
|
|
<itemData name="KeyType" defStyleNum="dsOthers" color="#009900" bold="1"/>
|
|
<itemData name="Value" defStyleNum="dsOthers" color="#003399"/>
|
|
<itemData name="Comment" defStyleNum="dsComment"/>
|
|
<itemData name="Symbol" defStyleNum="dsOthers" bold="1"/>
|
|
</itemDatas>
|
|
</highlighting>
|
|
<general>
|
|
<comments><comment name="singleLine" start="#"/></comments>
|
|
<keywords casesensitive="1"/>
|
|
</general>
|
|
</language>
|