mirror of
https://gitlab.kitware.com/cmake/cmake.git
synced 2026-10-12 23:43:59 +03:00
Merge topic 'llpkgc-integration'
4b1b35bad3Merge branch 'upstream-llpkgc' into llpkgc-integratione2db237fb6llpkgc 2024-07-18 (7958a1de)ff79e60dd0PkgC: Add update-llpkgc script Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !9674
This commit is contained in:
commit
bb497152f0
7 files changed
+1503
No files matched your search
Executable
+34
@@ -0,0 +1,34 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# Note: llpkgc *generates* a parser, thus this script requires npm be available
|
||||
|
||||
set -e
|
||||
set -x
|
||||
shopt -s dotglob
|
||||
|
||||
readonly name="llpkgc"
|
||||
readonly ownership="llpkgc upstream <kwrobot@kitware.com>"
|
||||
readonly subtree="Utilities/cmllpkgc"
|
||||
readonly repo="https://gitlab.kitware.com/utils/llpkgc.git"
|
||||
readonly tag="7958a1de42b9eec04676d547f6fcf5daa425fbcc"
|
||||
readonly shortlog=false
|
||||
readonly paths="
|
||||
bin
|
||||
src
|
||||
*.json
|
||||
"
|
||||
|
||||
extract_source() {
|
||||
git_archive
|
||||
npm install
|
||||
npm run build
|
||||
mv build/llpkgc/* "${extractdir}/${name}-reduced"
|
||||
|
||||
pushd "${extractdir}/${name}-reduced"
|
||||
rm CMakeLists.txt *.json
|
||||
rm -rf src bin
|
||||
echo "* -whitespace" > .gitattributes
|
||||
popd
|
||||
}
|
||||
|
||||
. "${BASH_SOURCE%/*}/update-third-party.bash"
|
||||
@@ -0,0 +1 @@
|
||||
* -whitespace
|
||||
@@ -0,0 +1,14 @@
|
||||
llpkgc
|
||||
******
|
||||
|
||||
This code is generated by the upstream llpkgc repository located at:
|
||||
https://gitlab.kitware.com/utils/llpkgc
|
||||
|
||||
Generally, updates to llpkgc should be made in the upstream utilities library
|
||||
unless they are exceptionally specific to CMake itself.
|
||||
|
||||
The upstream repository does not vendor a generated copy of the parser, so
|
||||
the associated update script for this dependency runs the generator and
|
||||
vendors it appropriately. This requires a reasonably up-to-date version of
|
||||
npm be available in addition to the normal 3rd-party update tooling
|
||||
requirements.
|
||||
@@ -0,0 +1,205 @@
|
||||
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
|
||||
file Copyright.txt or https://cmake.org/licensing for details. */
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "llpkgc.h"
|
||||
|
||||
#define CALLBACK_MAYBE(PARSER, NAME) \
|
||||
do { \
|
||||
const llpkgc_settings_t* settings; \
|
||||
settings = (const llpkgc_settings_t*) (PARSER)->settings; \
|
||||
if(settings == NULL || settings->NAME == NULL) { \
|
||||
err = 0; \
|
||||
break; \
|
||||
} \
|
||||
err = settings->NAME((PARSER)); \
|
||||
} while(0)
|
||||
|
||||
#define SPAN_CALLBACK_MAYBE(PARSER, NAME, START, LEN) \
|
||||
do { \
|
||||
const llpkgc_settings_t* settings; \
|
||||
settings = (const llpkgc_settings_t*) (PARSER)->settings; \
|
||||
if(settings == NULL || settings->NAME == NULL) { \
|
||||
err = 0; \
|
||||
break; \
|
||||
} \
|
||||
err = settings->NAME((PARSER), (START), (LEN)); \
|
||||
if(err == -1) { \
|
||||
err = PCE_USER; \
|
||||
llpkgc_set_error_reason((PARSER), "Span callback error in " #NAME); \
|
||||
} \
|
||||
} while(0)
|
||||
|
||||
void llpkgc_init(llpkgc_t* parser, const llpkgc_settings_t* settings) {
|
||||
llpkgc__internal_init(parser);
|
||||
|
||||
parser->settings = (void*) settings;
|
||||
}
|
||||
|
||||
void llpkgc_reset(llpkgc_t* parser) {
|
||||
llpkgc_settings_t* settings = parser->settings;
|
||||
void* data = parser->data;
|
||||
|
||||
llpkgc__internal_init(parser);
|
||||
|
||||
parser->settings = settings;
|
||||
parser->data = data;
|
||||
}
|
||||
|
||||
void llpkgc_settings_init(llpkgc_settings_t* settings) {
|
||||
memset(settings, 0, sizeof(*settings));
|
||||
}
|
||||
|
||||
llpkgc_errno_t llpkgc_execute(llpkgc_t* parser, const char* data, size_t len) {
|
||||
return llpkgc__internal_execute(parser, data, data + len);
|
||||
}
|
||||
|
||||
llpkgc_errno_t llpkgc_finish(llpkgc_t* parser) {
|
||||
if(parser->error != 0)
|
||||
return parser->error;
|
||||
|
||||
int err;
|
||||
// ToDo: Better handling of user callback errors here
|
||||
if(parser->unfinished_ == 1) {
|
||||
parser->reason = "Invalid EOF state";
|
||||
parser->error = PCE_UNFINISHED;
|
||||
return PCE_UNFINISHED;
|
||||
} else if(parser->unfinished_ == 2) {
|
||||
CALLBACK_MAYBE(parser, on_value_literal_complete);
|
||||
if(err != PCE_OK) {
|
||||
parser->error = err;
|
||||
return err;
|
||||
}
|
||||
CALLBACK_MAYBE(parser, on_value_complete);
|
||||
if(err != PCE_OK) {
|
||||
parser->error = err;
|
||||
return err;
|
||||
}
|
||||
} else if(parser->unfinished_ == 3) {
|
||||
CALLBACK_MAYBE(parser, on_value_complete);
|
||||
if(err != PCE_OK) {
|
||||
parser->error = err;
|
||||
return err;
|
||||
}
|
||||
}
|
||||
|
||||
CALLBACK_MAYBE(parser, on_pkgc_complete);
|
||||
return err;
|
||||
}
|
||||
|
||||
void llpkgc_pause(llpkgc_t* parser) {
|
||||
if(parser->error != PCE_OK) {
|
||||
return;
|
||||
}
|
||||
|
||||
parser->error = PCE_PAUSED;
|
||||
parser->reason = "Paused";
|
||||
}
|
||||
|
||||
void llpkgc_resume(llpkgc_t* parser) {
|
||||
if(parser->error != PCE_PAUSED) {
|
||||
return;
|
||||
}
|
||||
|
||||
parser->error = 0;
|
||||
}
|
||||
|
||||
llpkgc_errno_t llpkgc_get_errno(const llpkgc_t* parser) {
|
||||
return parser->error;
|
||||
}
|
||||
|
||||
const char* llpkgc_get_error_reason(const llpkgc_t* parser) {
|
||||
return parser->reason;
|
||||
}
|
||||
|
||||
void llpkgc_set_error_reason(llpkgc_t* parser, const char* reason) {
|
||||
parser->reason = reason;
|
||||
}
|
||||
|
||||
const char* llpkgc_get_error_pos(const llpkgc_t* parser) {
|
||||
return parser->error_pos;
|
||||
}
|
||||
|
||||
const char* llpkgc_errno_name(llpkgc_errno_t err) {
|
||||
switch(err) {
|
||||
case PCE_OK:
|
||||
return "PCE_OK";
|
||||
case PCE_INTERNAL:
|
||||
return "PCE_INTERNAL";
|
||||
case PCE_PAUSED:
|
||||
return "PCE_PAUSED";
|
||||
case PCE_USER:
|
||||
return "PCE_USER";
|
||||
case PCE_UNFINISHED:
|
||||
return "PCE_UNFINISHED";
|
||||
}
|
||||
return "INVALID_ERRNO";
|
||||
}
|
||||
|
||||
int llpkgc__line_begin(llpkgc_t* s, const char* p, const char* endp) {
|
||||
int err;
|
||||
s->unfinished_ = 1;
|
||||
CALLBACK_MAYBE(s, on_line_begin);
|
||||
return err;
|
||||
}
|
||||
|
||||
int llpkgc__key_span(llpkgc_t* s, const char* p, const char* endp) {
|
||||
int err;
|
||||
SPAN_CALLBACK_MAYBE(s, on_key, p, endp - p);
|
||||
return err;
|
||||
}
|
||||
|
||||
int llpkgc__keyword_complete(llpkgc_t* s, const char* p, const char* endp) {
|
||||
int err;
|
||||
s->unfinished_ = 3;
|
||||
CALLBACK_MAYBE(s, on_keyword_complete);
|
||||
return err;
|
||||
}
|
||||
|
||||
int llpkgc__variable_complete(llpkgc_t* s, const char* p, const char* endp) {
|
||||
int err;
|
||||
s->unfinished_ = 3;
|
||||
CALLBACK_MAYBE(s, on_variable_complete);
|
||||
return err;
|
||||
}
|
||||
|
||||
int llpkgc__vallit_span(llpkgc_t* s, const char* p, const char* endp) {
|
||||
int err;
|
||||
if(s->escaped_) {
|
||||
--endp;
|
||||
s->escaped_ = 0;
|
||||
}
|
||||
s->unfinished_ = 2;
|
||||
SPAN_CALLBACK_MAYBE(s, on_value_literal, p, endp - p);
|
||||
return err;
|
||||
}
|
||||
|
||||
int llpkgc__vallit_complete(llpkgc_t* s, const char* p, const char* endp) {
|
||||
int err;
|
||||
s->unfinished_ = 3;
|
||||
CALLBACK_MAYBE(s, on_value_literal_complete);
|
||||
return err;
|
||||
}
|
||||
|
||||
int llpkgc__valvar_span(llpkgc_t* s, const char* p, const char* endp) {
|
||||
int err;
|
||||
s->unfinished_ = 1;
|
||||
SPAN_CALLBACK_MAYBE(s, on_value_variable, p, endp - p);
|
||||
return err;
|
||||
}
|
||||
|
||||
int llpkgc__valvar_complete(llpkgc_t* s, const char* p, const char* endp) {
|
||||
int err;
|
||||
s->unfinished_ = 3;
|
||||
CALLBACK_MAYBE(s, on_value_variable_complete);
|
||||
return err;
|
||||
}
|
||||
|
||||
int llpkgc__value_complete(llpkgc_t* s, const char* p, const char* endp) {
|
||||
int err;
|
||||
s->unfinished_ = 0;
|
||||
CALLBACK_MAYBE(s, on_value_complete);
|
||||
return err;
|
||||
}
|
||||
@@ -0,0 +1,143 @@
|
||||
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
|
||||
file Copyright.txt or https://cmake.org/licensing for details. */
|
||||
|
||||
#ifndef INCLUDE_LLPKGC_API_H_
|
||||
#define INCLUDE_LLPKGC_API_H_
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
#include <stddef.h>
|
||||
|
||||
#include "llpkgc__internal.h"
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
#define LLPKGC_EXPORT __declspec(dllexport)
|
||||
#else
|
||||
#define LLPKGC_EXPORT __attribute__((visibility("default")))
|
||||
#endif
|
||||
|
||||
typedef llpkgc__internal_t llpkgc_t;
|
||||
typedef struct llpkgc_settings_s llpkgc_settings_t;
|
||||
|
||||
typedef int (*llpkgc_data_cb)(llpkgc_t*, const char* at, size_t length);
|
||||
typedef int (*llpkgc_cb)(llpkgc_t*);
|
||||
|
||||
struct llpkgc_settings_s {
|
||||
/* Possible return values 0, -1, PCE_USER */
|
||||
llpkgc_data_cb on_key;
|
||||
llpkgc_data_cb on_value_literal;
|
||||
llpkgc_data_cb on_value_variable;
|
||||
|
||||
/* Possible return values 0, -1, `PCE_PAUSED` */
|
||||
llpkgc_cb on_line_begin;
|
||||
llpkgc_cb on_keyword_complete;
|
||||
llpkgc_cb on_variable_complete;
|
||||
llpkgc_cb on_value_literal_complete;
|
||||
llpkgc_cb on_value_variable_complete;
|
||||
llpkgc_cb on_value_complete;
|
||||
llpkgc_cb on_pkgc_complete;
|
||||
};
|
||||
|
||||
enum llpkgc_errno {
|
||||
PCE_OK = 0,
|
||||
PCE_INTERNAL = 1,
|
||||
PCE_PAUSED = 2,
|
||||
PCE_USER = 3,
|
||||
PCE_UNFINISHED = 4,
|
||||
};
|
||||
typedef enum llpkgc_errno llpkgc_errno_t;
|
||||
|
||||
/* Initialize the parser with user settings.
|
||||
*
|
||||
* NOTE: lifetime of `settings` has to be at least the same as the lifetime of
|
||||
* the `parser` here. In practice, `settings` has to be either a static
|
||||
* variable or be allocated with `malloc`, `new`, etc.
|
||||
*/
|
||||
LLPKGC_EXPORT
|
||||
void llpkgc_init(llpkgc_t* parser, const llpkgc_settings_t* settings);
|
||||
|
||||
/* Reset an already initialized parser back to the start state, preserving the
|
||||
* existing callback settings and user data.
|
||||
*/
|
||||
LLPKGC_EXPORT
|
||||
void llpkgc_reset(llpkgc_t* parser);
|
||||
|
||||
/* Initialize the settings object */
|
||||
LLPKGC_EXPORT
|
||||
void llpkgc_settings_init(llpkgc_settings_t* settings);
|
||||
|
||||
/* Parse full or partial pc data, invoking user callbacks along the way.
|
||||
*
|
||||
* If any of `llpkgc_data_cb` returns errno not equal to `PCE_OK` - the parsing
|
||||
* interrupts, and such errno is returned from `llpkgc_execute()`. If
|
||||
* `PCE_PAUSED` was used as an errno, the execution can be resumed with
|
||||
* `llpkgc_resume()` call.
|
||||
*
|
||||
* NOTE: if this function ever returns a non-pause type error, it will continue
|
||||
* to return the same error upon each successive call up until `llpkgc_init()`
|
||||
* or `llpkgc_reset()` are called.
|
||||
*/
|
||||
LLPKGC_EXPORT
|
||||
llpkgc_errno_t llpkgc_execute(llpkgc_t* parser, const char* data, size_t len);
|
||||
|
||||
/* This method should be called when the input has reached EOF
|
||||
*
|
||||
* This method will invoke `on_pkgc_complete()` callback if the file was
|
||||
* terminated safely. Otherwise an error code will be returned.
|
||||
*/
|
||||
LLPKGC_EXPORT
|
||||
llpkgc_errno_t llpkgc_finish(llpkgc_t* parser);
|
||||
|
||||
/* Make further calls of `llpkgc_execute()` return `PCE_PAUSED` and set
|
||||
* appropriate error reason.
|
||||
*
|
||||
* Important: do not call this from user callbacks! User callbacks must return
|
||||
* `PCE_PAUSED` if pausing is required.
|
||||
*/
|
||||
LLPKGC_EXPORT
|
||||
void llpkgc_pause(llpkgc_t* parser);
|
||||
|
||||
/* Might be called to resume the execution after the pause in user's callback.
|
||||
* See `llpkgc_execute()` above for details.
|
||||
*
|
||||
* Call this only if `llpkgc_execute()` returns `PCE_PAUSED`.
|
||||
*/
|
||||
LLPKGC_EXPORT
|
||||
void llpkgc_resume(llpkgc_t* parser);
|
||||
|
||||
/* Returns the latest return error */
|
||||
LLPKGC_EXPORT
|
||||
llpkgc_errno_t llpkgc_get_errno(const llpkgc_t* parser);
|
||||
|
||||
/* Returns the verbal explanation of the latest returned error.
|
||||
*
|
||||
* Note: User callback should set error reason when returning the error. See
|
||||
* `llpkgc_set_error_reason()` for details.
|
||||
*/
|
||||
LLPKGC_EXPORT
|
||||
const char* llpkgc_get_error_reason(const llpkgc_t* parser);
|
||||
|
||||
/* Assign verbal description to the returned error. Must be called in user
|
||||
* callbacks right before returning the errno.
|
||||
*
|
||||
* Note: `PCE_USER` error code might be useful in user callbacks.
|
||||
*/
|
||||
LLPKGC_EXPORT
|
||||
void llpkgc_set_error_reason(llpkgc_t* parser, const char* reason);
|
||||
|
||||
/* Returns the pointer to the last parsed byte before the returned error. The
|
||||
* pointer is relative to the `data` argument of `llpkgc_execute()`.
|
||||
*
|
||||
* Note: this method might be useful for counting the number of parsed bytes.
|
||||
*/
|
||||
LLPKGC_EXPORT
|
||||
const char* llpkgc_get_error_pos(const llpkgc_t* parser);
|
||||
|
||||
/* Returns textual name of error code */
|
||||
LLPKGC_EXPORT
|
||||
const char* llpkgc_errno_name(llpkgc_errno_t err);
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
#endif
|
||||
#endif /* INCLUDE_LLPKGC_API_H_ */
|
||||
@@ -0,0 +1,1069 @@
|
||||
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
|
||||
file Copyright.txt or https://cmake.org/licensing for details. */
|
||||
|
||||
/* This code was generated by llpkgc, do not edit it by hand
|
||||
See: https://gitlab.kitware.com/utils/llpkgc */
|
||||
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdint.h>
|
||||
#include <string.h>
|
||||
|
||||
#ifdef __SSE4_2__
|
||||
#ifdef _MSC_VER
|
||||
#include <nmmintrin.h>
|
||||
#else /* !_MSC_VER */
|
||||
#include <x86intrin.h>
|
||||
#endif /* _MSC_VER */
|
||||
#endif /* __SSE4_2__ */
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#define ALIGN(n) _declspec(align(n))
|
||||
#else /* !_MSC_VER */
|
||||
#define ALIGN(n) __attribute__((aligned(n)))
|
||||
#endif /* _MSC_VER */
|
||||
|
||||
#include "llpkgc__internal.h"
|
||||
|
||||
typedef int (*llpkgc__internal__span_cb)(
|
||||
llpkgc__internal_t*, const char*, const char*);
|
||||
|
||||
enum llparse_state_e {
|
||||
s_error,
|
||||
s_n_llpkgc__internal__n_comment,
|
||||
s_n_llpkgc__internal__n_invoke_llpkgc__vallit_complete,
|
||||
s_n_llpkgc__internal__n_invoke_llpkgc__vallit_complete_1,
|
||||
s_n_llpkgc__internal__n_literal_skip_dollar,
|
||||
s_n_llpkgc__internal__n_invoke_llpkgc__vallit_complete_2,
|
||||
s_n_llpkgc__internal__n_maybe_CR,
|
||||
s_n_llpkgc__internal__n_skip_escaped_LF,
|
||||
s_n_llpkgc__internal__n_invoke_llpkgc__vallit_complete_3,
|
||||
s_n_llpkgc__internal__n_maybe_LF,
|
||||
s_n_llpkgc__internal__n_skip_escaped_CR,
|
||||
s_n_llpkgc__internal__n_invoke_llpkgc__vallit_complete_4,
|
||||
s_n_llpkgc__internal__n_literal_skip_hash,
|
||||
s_n_llpkgc__internal__n_span_start_llpkgc__vallit_span_1,
|
||||
s_n_llpkgc__internal__n_invoke_llpkgc__vallit_complete_5,
|
||||
s_n_llpkgc__internal__n_maybe_escaped,
|
||||
s_n_llpkgc__internal__n_literal,
|
||||
s_n_llpkgc__internal__n_variable_skip_dollar,
|
||||
s_n_llpkgc__internal__n_span_start_llpkgc__vallit_span,
|
||||
s_n_llpkgc__internal__n_span_start_llpkgc__vallit_span_2,
|
||||
s_n_llpkgc__internal__n_variable_close,
|
||||
s_n_llpkgc__internal__n_variable_skip_curly,
|
||||
s_n_llpkgc__internal__n_invoke_llpkgc__valvar_complete,
|
||||
s_n_llpkgc__internal__n_variable,
|
||||
s_n_llpkgc__internal__n_span_start_llpkgc__valvar_span,
|
||||
s_n_llpkgc__internal__n_maybe_variable,
|
||||
s_n_llpkgc__internal__n_expect_value,
|
||||
s_n_llpkgc__internal__n_expect_sep,
|
||||
s_n_llpkgc__internal__n_key,
|
||||
s_n_llpkgc__internal__n_span_start_llpkgc__key_span,
|
||||
s_n_llpkgc__internal__n_line_start,
|
||||
};
|
||||
typedef enum llparse_state_e llparse_state_t;
|
||||
|
||||
int llpkgc__key_span(
|
||||
llpkgc__internal_t* s, const unsigned char* p,
|
||||
const unsigned char* endp);
|
||||
|
||||
int llpkgc__vallit_span(
|
||||
llpkgc__internal_t* s, const unsigned char* p,
|
||||
const unsigned char* endp);
|
||||
|
||||
int llpkgc__valvar_span(
|
||||
llpkgc__internal_t* s, const unsigned char* p,
|
||||
const unsigned char* endp);
|
||||
|
||||
int llpkgc__line_begin(
|
||||
llpkgc__internal_t* s, const unsigned char* p,
|
||||
const unsigned char* endp);
|
||||
|
||||
int llpkgc__keyword_complete(
|
||||
llpkgc__internal_t* s, const unsigned char* p,
|
||||
const unsigned char* endp);
|
||||
|
||||
int llpkgc__value_complete(
|
||||
llpkgc__internal_t* s, const unsigned char* p,
|
||||
const unsigned char* endp);
|
||||
|
||||
int llpkgc__vallit_complete(
|
||||
llpkgc__internal_t* s, const unsigned char* p,
|
||||
const unsigned char* endp);
|
||||
|
||||
int llpkgc__internal__c_update_escaped_(
|
||||
llpkgc__internal_t* state,
|
||||
const unsigned char* p,
|
||||
const unsigned char* endp) {
|
||||
state->escaped_ = 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int llpkgc__valvar_complete(
|
||||
llpkgc__internal_t* s, const unsigned char* p,
|
||||
const unsigned char* endp);
|
||||
|
||||
int llpkgc__variable_complete(
|
||||
llpkgc__internal_t* s, const unsigned char* p,
|
||||
const unsigned char* endp);
|
||||
|
||||
int llpkgc__internal_init(llpkgc__internal_t* state) {
|
||||
memset(state, 0, sizeof(*state));
|
||||
state->_current = (void*) (intptr_t) s_n_llpkgc__internal__n_line_start;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static llparse_state_t llpkgc__internal__run(
|
||||
llpkgc__internal_t* state,
|
||||
const unsigned char* p,
|
||||
const unsigned char* endp) {
|
||||
int match;
|
||||
switch ((llparse_state_t) (intptr_t) state->_current) {
|
||||
case s_n_llpkgc__internal__n_comment:
|
||||
s_n_llpkgc__internal__n_comment: {
|
||||
if (p == endp) {
|
||||
return s_n_llpkgc__internal__n_comment;
|
||||
}
|
||||
switch (*p) {
|
||||
case 10: {
|
||||
p++;
|
||||
goto s_n_llpkgc__internal__n_line_start;
|
||||
}
|
||||
case 13: {
|
||||
p++;
|
||||
goto s_n_llpkgc__internal__n_line_start;
|
||||
}
|
||||
default: {
|
||||
p++;
|
||||
goto s_n_llpkgc__internal__n_comment;
|
||||
}
|
||||
}
|
||||
/* UNREACHABLE */;
|
||||
abort();
|
||||
}
|
||||
case s_n_llpkgc__internal__n_invoke_llpkgc__vallit_complete:
|
||||
s_n_llpkgc__internal__n_invoke_llpkgc__vallit_complete: {
|
||||
switch (llpkgc__vallit_complete(state, p, endp)) {
|
||||
case 0:
|
||||
goto s_n_llpkgc__internal__n_invoke_llpkgc__value_complete_1;
|
||||
default:
|
||||
goto s_n_llpkgc__internal__n_error_3;
|
||||
}
|
||||
/* UNREACHABLE */;
|
||||
abort();
|
||||
}
|
||||
case s_n_llpkgc__internal__n_invoke_llpkgc__vallit_complete_1:
|
||||
s_n_llpkgc__internal__n_invoke_llpkgc__vallit_complete_1: {
|
||||
switch (llpkgc__vallit_complete(state, p, endp)) {
|
||||
case 0:
|
||||
goto s_n_llpkgc__internal__n_invoke_llpkgc__value_complete_2;
|
||||
default:
|
||||
goto s_n_llpkgc__internal__n_error_5;
|
||||
}
|
||||
/* UNREACHABLE */;
|
||||
abort();
|
||||
}
|
||||
case s_n_llpkgc__internal__n_literal_skip_dollar:
|
||||
s_n_llpkgc__internal__n_literal_skip_dollar: {
|
||||
if (p == endp) {
|
||||
return s_n_llpkgc__internal__n_literal_skip_dollar;
|
||||
}
|
||||
p++;
|
||||
goto s_n_llpkgc__internal__n_maybe_variable;
|
||||
/* UNREACHABLE */;
|
||||
abort();
|
||||
}
|
||||
case s_n_llpkgc__internal__n_invoke_llpkgc__vallit_complete_2:
|
||||
s_n_llpkgc__internal__n_invoke_llpkgc__vallit_complete_2: {
|
||||
switch (llpkgc__vallit_complete(state, p, endp)) {
|
||||
case 0:
|
||||
goto s_n_llpkgc__internal__n_literal_skip_dollar;
|
||||
default:
|
||||
goto s_n_llpkgc__internal__n_error_7;
|
||||
}
|
||||
/* UNREACHABLE */;
|
||||
abort();
|
||||
}
|
||||
case s_n_llpkgc__internal__n_maybe_CR:
|
||||
s_n_llpkgc__internal__n_maybe_CR: {
|
||||
if (p == endp) {
|
||||
return s_n_llpkgc__internal__n_maybe_CR;
|
||||
}
|
||||
switch (*p) {
|
||||
case 13: {
|
||||
p++;
|
||||
goto s_n_llpkgc__internal__n_expect_value;
|
||||
}
|
||||
default: {
|
||||
goto s_n_llpkgc__internal__n_expect_value;
|
||||
}
|
||||
}
|
||||
/* UNREACHABLE */;
|
||||
abort();
|
||||
}
|
||||
case s_n_llpkgc__internal__n_skip_escaped_LF:
|
||||
s_n_llpkgc__internal__n_skip_escaped_LF: {
|
||||
if (p == endp) {
|
||||
return s_n_llpkgc__internal__n_skip_escaped_LF;
|
||||
}
|
||||
p++;
|
||||
goto s_n_llpkgc__internal__n_maybe_CR;
|
||||
/* UNREACHABLE */;
|
||||
abort();
|
||||
}
|
||||
case s_n_llpkgc__internal__n_invoke_llpkgc__vallit_complete_3:
|
||||
s_n_llpkgc__internal__n_invoke_llpkgc__vallit_complete_3: {
|
||||
switch (llpkgc__vallit_complete(state, p, endp)) {
|
||||
case 0:
|
||||
goto s_n_llpkgc__internal__n_skip_escaped_LF;
|
||||
default:
|
||||
goto s_n_llpkgc__internal__n_error_8;
|
||||
}
|
||||
/* UNREACHABLE */;
|
||||
abort();
|
||||
}
|
||||
case s_n_llpkgc__internal__n_maybe_LF:
|
||||
s_n_llpkgc__internal__n_maybe_LF: {
|
||||
if (p == endp) {
|
||||
return s_n_llpkgc__internal__n_maybe_LF;
|
||||
}
|
||||
switch (*p) {
|
||||
case 10: {
|
||||
p++;
|
||||
goto s_n_llpkgc__internal__n_expect_value;
|
||||
}
|
||||
default: {
|
||||
goto s_n_llpkgc__internal__n_expect_value;
|
||||
}
|
||||
}
|
||||
/* UNREACHABLE */;
|
||||
abort();
|
||||
}
|
||||
case s_n_llpkgc__internal__n_skip_escaped_CR:
|
||||
s_n_llpkgc__internal__n_skip_escaped_CR: {
|
||||
if (p == endp) {
|
||||
return s_n_llpkgc__internal__n_skip_escaped_CR;
|
||||
}
|
||||
p++;
|
||||
goto s_n_llpkgc__internal__n_maybe_LF;
|
||||
/* UNREACHABLE */;
|
||||
abort();
|
||||
}
|
||||
case s_n_llpkgc__internal__n_invoke_llpkgc__vallit_complete_4:
|
||||
s_n_llpkgc__internal__n_invoke_llpkgc__vallit_complete_4: {
|
||||
switch (llpkgc__vallit_complete(state, p, endp)) {
|
||||
case 0:
|
||||
goto s_n_llpkgc__internal__n_skip_escaped_CR;
|
||||
default:
|
||||
goto s_n_llpkgc__internal__n_error_9;
|
||||
}
|
||||
/* UNREACHABLE */;
|
||||
abort();
|
||||
}
|
||||
case s_n_llpkgc__internal__n_literal_skip_hash:
|
||||
s_n_llpkgc__internal__n_literal_skip_hash: {
|
||||
if (p == endp) {
|
||||
return s_n_llpkgc__internal__n_literal_skip_hash;
|
||||
}
|
||||
p++;
|
||||
goto s_n_llpkgc__internal__n_literal;
|
||||
/* UNREACHABLE */;
|
||||
abort();
|
||||
}
|
||||
case s_n_llpkgc__internal__n_span_start_llpkgc__vallit_span_1:
|
||||
s_n_llpkgc__internal__n_span_start_llpkgc__vallit_span_1: {
|
||||
if (p == endp) {
|
||||
return s_n_llpkgc__internal__n_span_start_llpkgc__vallit_span_1;
|
||||
}
|
||||
state->_span_pos0 = (void*) p;
|
||||
state->_span_cb0 = llpkgc__vallit_span;
|
||||
goto s_n_llpkgc__internal__n_literal_skip_hash;
|
||||
/* UNREACHABLE */;
|
||||
abort();
|
||||
}
|
||||
case s_n_llpkgc__internal__n_invoke_llpkgc__vallit_complete_5:
|
||||
s_n_llpkgc__internal__n_invoke_llpkgc__vallit_complete_5: {
|
||||
switch (llpkgc__vallit_complete(state, p, endp)) {
|
||||
case 0:
|
||||
goto s_n_llpkgc__internal__n_span_start_llpkgc__vallit_span_1;
|
||||
default:
|
||||
goto s_n_llpkgc__internal__n_error_10;
|
||||
}
|
||||
/* UNREACHABLE */;
|
||||
abort();
|
||||
}
|
||||
case s_n_llpkgc__internal__n_maybe_escaped:
|
||||
s_n_llpkgc__internal__n_maybe_escaped: {
|
||||
if (p == endp) {
|
||||
return s_n_llpkgc__internal__n_maybe_escaped;
|
||||
}
|
||||
switch (*p) {
|
||||
case 10: {
|
||||
goto s_n_llpkgc__internal__n_invoke_update_escaped_;
|
||||
}
|
||||
case 13: {
|
||||
goto s_n_llpkgc__internal__n_invoke_update_escaped__1;
|
||||
}
|
||||
case '#': {
|
||||
goto s_n_llpkgc__internal__n_invoke_update_escaped__2;
|
||||
}
|
||||
default: {
|
||||
goto s_n_llpkgc__internal__n_literal;
|
||||
}
|
||||
}
|
||||
/* UNREACHABLE */;
|
||||
abort();
|
||||
}
|
||||
case s_n_llpkgc__internal__n_literal:
|
||||
s_n_llpkgc__internal__n_literal: {
|
||||
if (p == endp) {
|
||||
return s_n_llpkgc__internal__n_literal;
|
||||
}
|
||||
switch (*p) {
|
||||
case 10: {
|
||||
goto s_n_llpkgc__internal__n_span_end_llpkgc__vallit_span;
|
||||
}
|
||||
case 13: {
|
||||
goto s_n_llpkgc__internal__n_span_end_llpkgc__vallit_span;
|
||||
}
|
||||
case '#': {
|
||||
goto s_n_llpkgc__internal__n_span_end_llpkgc__vallit_span_1;
|
||||
}
|
||||
case '$': {
|
||||
goto s_n_llpkgc__internal__n_span_end_llpkgc__vallit_span_2;
|
||||
}
|
||||
case 92: {
|
||||
p++;
|
||||
goto s_n_llpkgc__internal__n_maybe_escaped;
|
||||
}
|
||||
default: {
|
||||
p++;
|
||||
goto s_n_llpkgc__internal__n_literal;
|
||||
}
|
||||
}
|
||||
/* UNREACHABLE */;
|
||||
abort();
|
||||
}
|
||||
case s_n_llpkgc__internal__n_variable_skip_dollar:
|
||||
s_n_llpkgc__internal__n_variable_skip_dollar: {
|
||||
if (p == endp) {
|
||||
return s_n_llpkgc__internal__n_variable_skip_dollar;
|
||||
}
|
||||
p++;
|
||||
goto s_n_llpkgc__internal__n_literal;
|
||||
/* UNREACHABLE */;
|
||||
abort();
|
||||
}
|
||||
case s_n_llpkgc__internal__n_span_start_llpkgc__vallit_span:
|
||||
s_n_llpkgc__internal__n_span_start_llpkgc__vallit_span: {
|
||||
if (p == endp) {
|
||||
return s_n_llpkgc__internal__n_span_start_llpkgc__vallit_span;
|
||||
}
|
||||
state->_span_pos0 = (void*) p;
|
||||
state->_span_cb0 = llpkgc__vallit_span;
|
||||
goto s_n_llpkgc__internal__n_variable_skip_dollar;
|
||||
/* UNREACHABLE */;
|
||||
abort();
|
||||
}
|
||||
case s_n_llpkgc__internal__n_span_start_llpkgc__vallit_span_2:
|
||||
s_n_llpkgc__internal__n_span_start_llpkgc__vallit_span_2: {
|
||||
if (p == endp) {
|
||||
return s_n_llpkgc__internal__n_span_start_llpkgc__vallit_span_2;
|
||||
}
|
||||
state->_span_pos0 = (void*) p;
|
||||
state->_span_cb0 = llpkgc__vallit_span;
|
||||
goto s_n_llpkgc__internal__n_literal;
|
||||
/* UNREACHABLE */;
|
||||
abort();
|
||||
}
|
||||
case s_n_llpkgc__internal__n_variable_close:
|
||||
s_n_llpkgc__internal__n_variable_close: {
|
||||
if (p == endp) {
|
||||
return s_n_llpkgc__internal__n_variable_close;
|
||||
}
|
||||
switch (*p) {
|
||||
case 10: {
|
||||
goto s_n_llpkgc__internal__n_invoke_llpkgc__value_complete;
|
||||
}
|
||||
case 13: {
|
||||
goto s_n_llpkgc__internal__n_invoke_llpkgc__value_complete;
|
||||
}
|
||||
case '#': {
|
||||
goto s_n_llpkgc__internal__n_invoke_llpkgc__value_complete;
|
||||
}
|
||||
case '$': {
|
||||
p++;
|
||||
goto s_n_llpkgc__internal__n_maybe_variable;
|
||||
}
|
||||
default: {
|
||||
goto s_n_llpkgc__internal__n_span_start_llpkgc__vallit_span_2;
|
||||
}
|
||||
}
|
||||
/* UNREACHABLE */;
|
||||
abort();
|
||||
}
|
||||
case s_n_llpkgc__internal__n_variable_skip_curly:
|
||||
s_n_llpkgc__internal__n_variable_skip_curly: {
|
||||
if (p == endp) {
|
||||
return s_n_llpkgc__internal__n_variable_skip_curly;
|
||||
}
|
||||
p++;
|
||||
goto s_n_llpkgc__internal__n_variable_close;
|
||||
/* UNREACHABLE */;
|
||||
abort();
|
||||
}
|
||||
case s_n_llpkgc__internal__n_invoke_llpkgc__valvar_complete:
|
||||
s_n_llpkgc__internal__n_invoke_llpkgc__valvar_complete: {
|
||||
switch (llpkgc__valvar_complete(state, p, endp)) {
|
||||
case 0:
|
||||
goto s_n_llpkgc__internal__n_variable_skip_curly;
|
||||
default:
|
||||
goto s_n_llpkgc__internal__n_error_11;
|
||||
}
|
||||
/* UNREACHABLE */;
|
||||
abort();
|
||||
}
|
||||
case s_n_llpkgc__internal__n_variable:
|
||||
s_n_llpkgc__internal__n_variable: {
|
||||
static uint8_t lookup_table[] = {
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0,
|
||||
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0,
|
||||
0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
|
||||
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 1,
|
||||
0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
|
||||
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 2, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
|
||||
};
|
||||
if (p == endp) {
|
||||
return s_n_llpkgc__internal__n_variable;
|
||||
}
|
||||
switch (lookup_table[(uint8_t) *p]) {
|
||||
case 1: {
|
||||
p++;
|
||||
goto s_n_llpkgc__internal__n_variable;
|
||||
}
|
||||
case 2: {
|
||||
goto s_n_llpkgc__internal__n_span_end_llpkgc__valvar_span;
|
||||
}
|
||||
default: {
|
||||
goto s_n_llpkgc__internal__n_error_12;
|
||||
}
|
||||
}
|
||||
/* UNREACHABLE */;
|
||||
abort();
|
||||
}
|
||||
case s_n_llpkgc__internal__n_span_start_llpkgc__valvar_span:
|
||||
s_n_llpkgc__internal__n_span_start_llpkgc__valvar_span: {
|
||||
if (p == endp) {
|
||||
return s_n_llpkgc__internal__n_span_start_llpkgc__valvar_span;
|
||||
}
|
||||
state->_span_pos0 = (void*) p;
|
||||
state->_span_cb0 = llpkgc__valvar_span;
|
||||
goto s_n_llpkgc__internal__n_variable;
|
||||
/* UNREACHABLE */;
|
||||
abort();
|
||||
}
|
||||
case s_n_llpkgc__internal__n_maybe_variable:
|
||||
s_n_llpkgc__internal__n_maybe_variable: {
|
||||
if (p == endp) {
|
||||
return s_n_llpkgc__internal__n_maybe_variable;
|
||||
}
|
||||
switch (*p) {
|
||||
case '$': {
|
||||
goto s_n_llpkgc__internal__n_span_start_llpkgc__vallit_span;
|
||||
}
|
||||
case '{': {
|
||||
p++;
|
||||
goto s_n_llpkgc__internal__n_span_start_llpkgc__valvar_span;
|
||||
}
|
||||
default: {
|
||||
goto s_n_llpkgc__internal__n_error_13;
|
||||
}
|
||||
}
|
||||
/* UNREACHABLE */;
|
||||
abort();
|
||||
}
|
||||
case s_n_llpkgc__internal__n_expect_value:
|
||||
s_n_llpkgc__internal__n_expect_value: {
|
||||
if (p == endp) {
|
||||
return s_n_llpkgc__internal__n_expect_value;
|
||||
}
|
||||
switch (*p) {
|
||||
case 9: {
|
||||
p++;
|
||||
goto s_n_llpkgc__internal__n_expect_value;
|
||||
}
|
||||
case 10: {
|
||||
goto s_n_llpkgc__internal__n_invoke_llpkgc__value_complete;
|
||||
}
|
||||
case 13: {
|
||||
goto s_n_llpkgc__internal__n_invoke_llpkgc__value_complete;
|
||||
}
|
||||
case ' ': {
|
||||
p++;
|
||||
goto s_n_llpkgc__internal__n_expect_value;
|
||||
}
|
||||
case '#': {
|
||||
goto s_n_llpkgc__internal__n_invoke_llpkgc__value_complete;
|
||||
}
|
||||
case '$': {
|
||||
p++;
|
||||
goto s_n_llpkgc__internal__n_maybe_variable;
|
||||
}
|
||||
default: {
|
||||
goto s_n_llpkgc__internal__n_span_start_llpkgc__vallit_span_2;
|
||||
}
|
||||
}
|
||||
/* UNREACHABLE */;
|
||||
abort();
|
||||
}
|
||||
case s_n_llpkgc__internal__n_expect_sep:
|
||||
s_n_llpkgc__internal__n_expect_sep: {
|
||||
if (p == endp) {
|
||||
return s_n_llpkgc__internal__n_expect_sep;
|
||||
}
|
||||
switch (*p) {
|
||||
case 9: {
|
||||
p++;
|
||||
goto s_n_llpkgc__internal__n_expect_sep;
|
||||
}
|
||||
case ' ': {
|
||||
p++;
|
||||
goto s_n_llpkgc__internal__n_expect_sep;
|
||||
}
|
||||
case ':': {
|
||||
p++;
|
||||
goto s_n_llpkgc__internal__n_invoke_llpkgc__keyword_complete;
|
||||
}
|
||||
case '=': {
|
||||
p++;
|
||||
goto s_n_llpkgc__internal__n_invoke_llpkgc__variable_complete;
|
||||
}
|
||||
default: {
|
||||
goto s_n_llpkgc__internal__n_error_15;
|
||||
}
|
||||
}
|
||||
/* UNREACHABLE */;
|
||||
abort();
|
||||
}
|
||||
case s_n_llpkgc__internal__n_key:
|
||||
s_n_llpkgc__internal__n_key: {
|
||||
static uint8_t lookup_table[] = {
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0,
|
||||
2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 0, 0, 1, 0, 0,
|
||||
0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
||||
2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 2,
|
||||
0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
||||
2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
|
||||
};
|
||||
if (p == endp) {
|
||||
return s_n_llpkgc__internal__n_key;
|
||||
}
|
||||
switch (lookup_table[(uint8_t) *p]) {
|
||||
case 1: {
|
||||
goto s_n_llpkgc__internal__n_span_end_llpkgc__key_span;
|
||||
}
|
||||
case 2: {
|
||||
p++;
|
||||
goto s_n_llpkgc__internal__n_key;
|
||||
}
|
||||
default: {
|
||||
goto s_n_llpkgc__internal__n_error_16;
|
||||
}
|
||||
}
|
||||
/* UNREACHABLE */;
|
||||
abort();
|
||||
}
|
||||
case s_n_llpkgc__internal__n_span_start_llpkgc__key_span:
|
||||
s_n_llpkgc__internal__n_span_start_llpkgc__key_span: {
|
||||
if (p == endp) {
|
||||
return s_n_llpkgc__internal__n_span_start_llpkgc__key_span;
|
||||
}
|
||||
state->_span_pos0 = (void*) p;
|
||||
state->_span_cb0 = llpkgc__key_span;
|
||||
goto s_n_llpkgc__internal__n_key;
|
||||
/* UNREACHABLE */;
|
||||
abort();
|
||||
}
|
||||
case s_n_llpkgc__internal__n_line_start:
|
||||
s_n_llpkgc__internal__n_line_start: {
|
||||
static uint8_t lookup_table[] = {
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 1, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
1, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0,
|
||||
3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 0, 0, 0, 0, 0, 0,
|
||||
0, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
|
||||
3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 0, 0, 0, 0, 3,
|
||||
0, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
|
||||
3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
|
||||
};
|
||||
if (p == endp) {
|
||||
return s_n_llpkgc__internal__n_line_start;
|
||||
}
|
||||
switch (lookup_table[(uint8_t) *p]) {
|
||||
case 1: {
|
||||
p++;
|
||||
goto s_n_llpkgc__internal__n_line_start;
|
||||
}
|
||||
case 2: {
|
||||
p++;
|
||||
goto s_n_llpkgc__internal__n_comment;
|
||||
}
|
||||
case 3: {
|
||||
goto s_n_llpkgc__internal__n_invoke_llpkgc__line_begin;
|
||||
}
|
||||
default: {
|
||||
goto s_n_llpkgc__internal__n_error_17;
|
||||
}
|
||||
}
|
||||
/* UNREACHABLE */;
|
||||
abort();
|
||||
}
|
||||
default:
|
||||
/* UNREACHABLE */
|
||||
abort();
|
||||
}
|
||||
s_n_llpkgc__internal__n_error_2: {
|
||||
state->error = 0xb;
|
||||
state->reason = "Value complete error";
|
||||
state->error_pos = (const char*) p;
|
||||
state->_current = (void*) (intptr_t) s_error;
|
||||
return s_error;
|
||||
/* UNREACHABLE */;
|
||||
abort();
|
||||
}
|
||||
s_n_llpkgc__internal__n_invoke_llpkgc__value_complete: {
|
||||
switch (llpkgc__value_complete(state, p, endp)) {
|
||||
case 0:
|
||||
goto s_n_llpkgc__internal__n_line_start;
|
||||
default:
|
||||
goto s_n_llpkgc__internal__n_error_2;
|
||||
}
|
||||
/* UNREACHABLE */;
|
||||
abort();
|
||||
}
|
||||
s_n_llpkgc__internal__n_error_4: {
|
||||
state->error = 0xb;
|
||||
state->reason = "Value complete error";
|
||||
state->error_pos = (const char*) p;
|
||||
state->_current = (void*) (intptr_t) s_error;
|
||||
return s_error;
|
||||
/* UNREACHABLE */;
|
||||
abort();
|
||||
}
|
||||
s_n_llpkgc__internal__n_invoke_llpkgc__value_complete_1: {
|
||||
switch (llpkgc__value_complete(state, p, endp)) {
|
||||
case 0:
|
||||
goto s_n_llpkgc__internal__n_line_start;
|
||||
default:
|
||||
goto s_n_llpkgc__internal__n_error_4;
|
||||
}
|
||||
/* UNREACHABLE */;
|
||||
abort();
|
||||
}
|
||||
s_n_llpkgc__internal__n_error_3: {
|
||||
state->error = 0xa;
|
||||
state->reason = "Literal complete error";
|
||||
state->error_pos = (const char*) p;
|
||||
state->_current = (void*) (intptr_t) s_error;
|
||||
return s_error;
|
||||
/* UNREACHABLE */;
|
||||
abort();
|
||||
}
|
||||
s_n_llpkgc__internal__n_span_end_llpkgc__vallit_span: {
|
||||
const unsigned char* start;
|
||||
int err;
|
||||
|
||||
start = state->_span_pos0;
|
||||
state->_span_pos0 = NULL;
|
||||
err = llpkgc__vallit_span(state, start, p);
|
||||
if (err != 0) {
|
||||
state->error = err;
|
||||
state->error_pos = (const char*) p;
|
||||
state->_current = (void*) (intptr_t) s_n_llpkgc__internal__n_invoke_llpkgc__vallit_complete;
|
||||
return s_error;
|
||||
}
|
||||
goto s_n_llpkgc__internal__n_invoke_llpkgc__vallit_complete;
|
||||
/* UNREACHABLE */;
|
||||
abort();
|
||||
}
|
||||
s_n_llpkgc__internal__n_error_6: {
|
||||
state->error = 0xb;
|
||||
state->reason = "Value complete error";
|
||||
state->error_pos = (const char*) p;
|
||||
state->_current = (void*) (intptr_t) s_error;
|
||||
return s_error;
|
||||
/* UNREACHABLE */;
|
||||
abort();
|
||||
}
|
||||
s_n_llpkgc__internal__n_invoke_llpkgc__value_complete_2: {
|
||||
switch (llpkgc__value_complete(state, p, endp)) {
|
||||
case 0:
|
||||
goto s_n_llpkgc__internal__n_comment;
|
||||
default:
|
||||
goto s_n_llpkgc__internal__n_error_6;
|
||||
}
|
||||
/* UNREACHABLE */;
|
||||
abort();
|
||||
}
|
||||
s_n_llpkgc__internal__n_error_5: {
|
||||
state->error = 0xa;
|
||||
state->reason = "Literal complete error";
|
||||
state->error_pos = (const char*) p;
|
||||
state->_current = (void*) (intptr_t) s_error;
|
||||
return s_error;
|
||||
/* UNREACHABLE */;
|
||||
abort();
|
||||
}
|
||||
s_n_llpkgc__internal__n_span_end_llpkgc__vallit_span_1: {
|
||||
const unsigned char* start;
|
||||
int err;
|
||||
|
||||
start = state->_span_pos0;
|
||||
state->_span_pos0 = NULL;
|
||||
err = llpkgc__vallit_span(state, start, p);
|
||||
if (err != 0) {
|
||||
state->error = err;
|
||||
state->error_pos = (const char*) p;
|
||||
state->_current = (void*) (intptr_t) s_n_llpkgc__internal__n_invoke_llpkgc__vallit_complete_1;
|
||||
return s_error;
|
||||
}
|
||||
goto s_n_llpkgc__internal__n_invoke_llpkgc__vallit_complete_1;
|
||||
/* UNREACHABLE */;
|
||||
abort();
|
||||
}
|
||||
s_n_llpkgc__internal__n_error_7: {
|
||||
state->error = 0xa;
|
||||
state->reason = "Literal complete error";
|
||||
state->error_pos = (const char*) p;
|
||||
state->_current = (void*) (intptr_t) s_error;
|
||||
return s_error;
|
||||
/* UNREACHABLE */;
|
||||
abort();
|
||||
}
|
||||
s_n_llpkgc__internal__n_span_end_llpkgc__vallit_span_2: {
|
||||
const unsigned char* start;
|
||||
int err;
|
||||
|
||||
start = state->_span_pos0;
|
||||
state->_span_pos0 = NULL;
|
||||
err = llpkgc__vallit_span(state, start, p);
|
||||
if (err != 0) {
|
||||
state->error = err;
|
||||
state->error_pos = (const char*) p;
|
||||
state->_current = (void*) (intptr_t) s_n_llpkgc__internal__n_invoke_llpkgc__vallit_complete_2;
|
||||
return s_error;
|
||||
}
|
||||
goto s_n_llpkgc__internal__n_invoke_llpkgc__vallit_complete_2;
|
||||
/* UNREACHABLE */;
|
||||
abort();
|
||||
}
|
||||
s_n_llpkgc__internal__n_error_8: {
|
||||
state->error = 0xa;
|
||||
state->reason = "Literal complete error";
|
||||
state->error_pos = (const char*) p;
|
||||
state->_current = (void*) (intptr_t) s_error;
|
||||
return s_error;
|
||||
/* UNREACHABLE */;
|
||||
abort();
|
||||
}
|
||||
s_n_llpkgc__internal__n_span_end_llpkgc__vallit_span_3: {
|
||||
const unsigned char* start;
|
||||
int err;
|
||||
|
||||
start = state->_span_pos0;
|
||||
state->_span_pos0 = NULL;
|
||||
err = llpkgc__vallit_span(state, start, p);
|
||||
if (err != 0) {
|
||||
state->error = err;
|
||||
state->error_pos = (const char*) p;
|
||||
state->_current = (void*) (intptr_t) s_n_llpkgc__internal__n_invoke_llpkgc__vallit_complete_3;
|
||||
return s_error;
|
||||
}
|
||||
goto s_n_llpkgc__internal__n_invoke_llpkgc__vallit_complete_3;
|
||||
/* UNREACHABLE */;
|
||||
abort();
|
||||
}
|
||||
s_n_llpkgc__internal__n_invoke_update_escaped_: {
|
||||
switch (llpkgc__internal__c_update_escaped_(state, p, endp)) {
|
||||
default:
|
||||
goto s_n_llpkgc__internal__n_span_end_llpkgc__vallit_span_3;
|
||||
}
|
||||
/* UNREACHABLE */;
|
||||
abort();
|
||||
}
|
||||
s_n_llpkgc__internal__n_error_9: {
|
||||
state->error = 0xa;
|
||||
state->reason = "Literal complete error";
|
||||
state->error_pos = (const char*) p;
|
||||
state->_current = (void*) (intptr_t) s_error;
|
||||
return s_error;
|
||||
/* UNREACHABLE */;
|
||||
abort();
|
||||
}
|
||||
s_n_llpkgc__internal__n_span_end_llpkgc__vallit_span_4: {
|
||||
const unsigned char* start;
|
||||
int err;
|
||||
|
||||
start = state->_span_pos0;
|
||||
state->_span_pos0 = NULL;
|
||||
err = llpkgc__vallit_span(state, start, p);
|
||||
if (err != 0) {
|
||||
state->error = err;
|
||||
state->error_pos = (const char*) p;
|
||||
state->_current = (void*) (intptr_t) s_n_llpkgc__internal__n_invoke_llpkgc__vallit_complete_4;
|
||||
return s_error;
|
||||
}
|
||||
goto s_n_llpkgc__internal__n_invoke_llpkgc__vallit_complete_4;
|
||||
/* UNREACHABLE */;
|
||||
abort();
|
||||
}
|
||||
s_n_llpkgc__internal__n_invoke_update_escaped__1: {
|
||||
switch (llpkgc__internal__c_update_escaped_(state, p, endp)) {
|
||||
default:
|
||||
goto s_n_llpkgc__internal__n_span_end_llpkgc__vallit_span_4;
|
||||
}
|
||||
/* UNREACHABLE */;
|
||||
abort();
|
||||
}
|
||||
s_n_llpkgc__internal__n_error_10: {
|
||||
state->error = 0xa;
|
||||
state->reason = "Literal complete error";
|
||||
state->error_pos = (const char*) p;
|
||||
state->_current = (void*) (intptr_t) s_error;
|
||||
return s_error;
|
||||
/* UNREACHABLE */;
|
||||
abort();
|
||||
}
|
||||
s_n_llpkgc__internal__n_span_end_llpkgc__vallit_span_5: {
|
||||
const unsigned char* start;
|
||||
int err;
|
||||
|
||||
start = state->_span_pos0;
|
||||
state->_span_pos0 = NULL;
|
||||
err = llpkgc__vallit_span(state, start, p);
|
||||
if (err != 0) {
|
||||
state->error = err;
|
||||
state->error_pos = (const char*) p;
|
||||
state->_current = (void*) (intptr_t) s_n_llpkgc__internal__n_invoke_llpkgc__vallit_complete_5;
|
||||
return s_error;
|
||||
}
|
||||
goto s_n_llpkgc__internal__n_invoke_llpkgc__vallit_complete_5;
|
||||
/* UNREACHABLE */;
|
||||
abort();
|
||||
}
|
||||
s_n_llpkgc__internal__n_invoke_update_escaped__2: {
|
||||
switch (llpkgc__internal__c_update_escaped_(state, p, endp)) {
|
||||
default:
|
||||
goto s_n_llpkgc__internal__n_span_end_llpkgc__vallit_span_5;
|
||||
}
|
||||
/* UNREACHABLE */;
|
||||
abort();
|
||||
}
|
||||
s_n_llpkgc__internal__n_error_11: {
|
||||
state->error = 0xc;
|
||||
state->reason = "Variable complete error";
|
||||
state->error_pos = (const char*) p;
|
||||
state->_current = (void*) (intptr_t) s_error;
|
||||
return s_error;
|
||||
/* UNREACHABLE */;
|
||||
abort();
|
||||
}
|
||||
s_n_llpkgc__internal__n_span_end_llpkgc__valvar_span: {
|
||||
const unsigned char* start;
|
||||
int err;
|
||||
|
||||
start = state->_span_pos0;
|
||||
state->_span_pos0 = NULL;
|
||||
err = llpkgc__valvar_span(state, start, p);
|
||||
if (err != 0) {
|
||||
state->error = err;
|
||||
state->error_pos = (const char*) p;
|
||||
state->_current = (void*) (intptr_t) s_n_llpkgc__internal__n_invoke_llpkgc__valvar_complete;
|
||||
return s_error;
|
||||
}
|
||||
goto s_n_llpkgc__internal__n_invoke_llpkgc__valvar_complete;
|
||||
/* UNREACHABLE */;
|
||||
abort();
|
||||
}
|
||||
s_n_llpkgc__internal__n_error_12: {
|
||||
state->error = 0xd;
|
||||
state->reason = "Invalid variable character";
|
||||
state->error_pos = (const char*) p;
|
||||
state->_current = (void*) (intptr_t) s_error;
|
||||
return s_error;
|
||||
/* UNREACHABLE */;
|
||||
abort();
|
||||
}
|
||||
s_n_llpkgc__internal__n_error_13: {
|
||||
state->error = 0x9;
|
||||
state->reason = "Unexpected `$`";
|
||||
state->error_pos = (const char*) p;
|
||||
state->_current = (void*) (intptr_t) s_error;
|
||||
return s_error;
|
||||
/* UNREACHABLE */;
|
||||
abort();
|
||||
}
|
||||
s_n_llpkgc__internal__n_error_1: {
|
||||
state->error = 0x5;
|
||||
state->reason = "Keyword complete error";
|
||||
state->error_pos = (const char*) p;
|
||||
state->_current = (void*) (intptr_t) s_error;
|
||||
return s_error;
|
||||
/* UNREACHABLE */;
|
||||
abort();
|
||||
}
|
||||
s_n_llpkgc__internal__n_invoke_llpkgc__keyword_complete: {
|
||||
switch (llpkgc__keyword_complete(state, p, endp)) {
|
||||
case 0:
|
||||
goto s_n_llpkgc__internal__n_expect_value;
|
||||
default:
|
||||
goto s_n_llpkgc__internal__n_error_1;
|
||||
}
|
||||
/* UNREACHABLE */;
|
||||
abort();
|
||||
}
|
||||
s_n_llpkgc__internal__n_error_14: {
|
||||
state->error = 0x6;
|
||||
state->reason = "Variable complete error";
|
||||
state->error_pos = (const char*) p;
|
||||
state->_current = (void*) (intptr_t) s_error;
|
||||
return s_error;
|
||||
/* UNREACHABLE */;
|
||||
abort();
|
||||
}
|
||||
s_n_llpkgc__internal__n_invoke_llpkgc__variable_complete: {
|
||||
switch (llpkgc__variable_complete(state, p, endp)) {
|
||||
case 0:
|
||||
goto s_n_llpkgc__internal__n_expect_value;
|
||||
default:
|
||||
goto s_n_llpkgc__internal__n_error_14;
|
||||
}
|
||||
/* UNREACHABLE */;
|
||||
abort();
|
||||
}
|
||||
s_n_llpkgc__internal__n_error_15: {
|
||||
state->error = 0x7;
|
||||
state->reason = "Expected seperator";
|
||||
state->error_pos = (const char*) p;
|
||||
state->_current = (void*) (intptr_t) s_error;
|
||||
return s_error;
|
||||
/* UNREACHABLE */;
|
||||
abort();
|
||||
}
|
||||
s_n_llpkgc__internal__n_span_end_llpkgc__key_span: {
|
||||
const unsigned char* start;
|
||||
int err;
|
||||
|
||||
start = state->_span_pos0;
|
||||
state->_span_pos0 = NULL;
|
||||
err = llpkgc__key_span(state, start, p);
|
||||
if (err != 0) {
|
||||
state->error = err;
|
||||
state->error_pos = (const char*) p;
|
||||
state->_current = (void*) (intptr_t) s_n_llpkgc__internal__n_expect_sep;
|
||||
return s_error;
|
||||
}
|
||||
goto s_n_llpkgc__internal__n_expect_sep;
|
||||
/* UNREACHABLE */;
|
||||
abort();
|
||||
}
|
||||
s_n_llpkgc__internal__n_error_16: {
|
||||
state->error = 0x4;
|
||||
state->reason = "Invalid key character";
|
||||
state->error_pos = (const char*) p;
|
||||
state->_current = (void*) (intptr_t) s_error;
|
||||
return s_error;
|
||||
/* UNREACHABLE */;
|
||||
abort();
|
||||
}
|
||||
s_n_llpkgc__internal__n_error: {
|
||||
state->error = 0x63;
|
||||
state->reason = "Line start error";
|
||||
state->error_pos = (const char*) p;
|
||||
state->_current = (void*) (intptr_t) s_error;
|
||||
return s_error;
|
||||
/* UNREACHABLE */;
|
||||
abort();
|
||||
}
|
||||
s_n_llpkgc__internal__n_invoke_llpkgc__line_begin: {
|
||||
switch (llpkgc__line_begin(state, p, endp)) {
|
||||
case 0:
|
||||
goto s_n_llpkgc__internal__n_span_start_llpkgc__key_span;
|
||||
default:
|
||||
goto s_n_llpkgc__internal__n_error;
|
||||
}
|
||||
/* UNREACHABLE */;
|
||||
abort();
|
||||
}
|
||||
s_n_llpkgc__internal__n_error_17: {
|
||||
state->error = 0x2;
|
||||
state->reason = "Expected key";
|
||||
state->error_pos = (const char*) p;
|
||||
state->_current = (void*) (intptr_t) s_error;
|
||||
return s_error;
|
||||
/* UNREACHABLE */;
|
||||
abort();
|
||||
}
|
||||
}
|
||||
|
||||
int llpkgc__internal_execute(llpkgc__internal_t* state, const char* p, const char* endp) {
|
||||
llparse_state_t next;
|
||||
|
||||
/* check lingering errors */
|
||||
if (state->error != 0) {
|
||||
return state->error;
|
||||
}
|
||||
|
||||
/* restart spans */
|
||||
if (state->_span_pos0 != NULL) {
|
||||
state->_span_pos0 = (void*) p;
|
||||
}
|
||||
|
||||
next = llpkgc__internal__run(state, (const unsigned char*) p, (const unsigned char*) endp);
|
||||
if (next == s_error) {
|
||||
return state->error;
|
||||
}
|
||||
state->_current = (void*) (intptr_t) next;
|
||||
|
||||
/* execute spans */
|
||||
if (state->_span_pos0 != NULL) {
|
||||
int error;
|
||||
|
||||
error = ((llpkgc__internal__span_cb) state->_span_cb0)(state, state->_span_pos0, (const char*) endp);
|
||||
if (error != 0) {
|
||||
state->error = error;
|
||||
state->error_pos = endp;
|
||||
return error;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
|
||||
file Copyright.txt or https://cmake.org/licensing for details. */
|
||||
|
||||
/* This code was generated by llpkgc, do not edit it by hand
|
||||
See: https://gitlab.kitware.com/utils/llpkgc */
|
||||
|
||||
|
||||
#ifndef INCLUDE_LLPKGC__INTERNAL_H_
|
||||
#define INCLUDE_LLPKGC__INTERNAL_H_
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
typedef struct llpkgc__internal_s llpkgc__internal_t;
|
||||
struct llpkgc__internal_s {
|
||||
int32_t _index;
|
||||
void* _span_pos0;
|
||||
void* _span_cb0;
|
||||
int32_t error;
|
||||
const char* reason;
|
||||
const char* error_pos;
|
||||
void* data;
|
||||
void* _current;
|
||||
void* settings;
|
||||
uint8_t unfinished_;
|
||||
uint8_t escaped_;
|
||||
};
|
||||
|
||||
int llpkgc__internal_init(llpkgc__internal_t* s);
|
||||
int llpkgc__internal_execute(llpkgc__internal_t* s, const char* p, const char* endp);
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
#endif
|
||||
#endif /* INCLUDE_LLPKGC__INTERNAL_H_ */
|
||||
Reference in new issue
Block a user