2022-06-03 14:34:08 -04:00
|
|
|
// Static XML symbols
|
|
|
|
//
|
|
|
|
// Copyright (C) 2014-2022 Ryan Specialty Group, LLC.
|
|
|
|
//
|
|
|
|
// This file is part of TAME.
|
|
|
|
//
|
|
|
|
// This program is free software: you can redistribute it and/or modify
|
|
|
|
// it under the terms of the GNU General Public License as published by
|
|
|
|
// the Free Software Foundation, either version 3 of the License, or
|
|
|
|
// (at your option) any later version.
|
|
|
|
//
|
|
|
|
// This program is distributed in the hope that it will be useful,
|
|
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
// GNU General Public License for more details.
|
|
|
|
//
|
|
|
|
// You should have received a copy of the GNU General Public License
|
|
|
|
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
|
|
|
|
//! Static XML symbols.
|
|
|
|
//!
|
|
|
|
//! This is analogous to [`crate::sym::st`].
|
|
|
|
|
|
|
|
pub mod qname {
|
|
|
|
//! Static [`QName`]s.
|
|
|
|
|
|
|
|
use crate::sym::st::*;
|
|
|
|
use crate::sym::{
|
|
|
|
CIdentStaticSymbolId, StaticSymbolId, TameIdentStaticSymbolId,
|
|
|
|
};
|
|
|
|
|
|
|
|
#[cfg(doc)]
|
|
|
|
use super::super::QName;
|
|
|
|
|
|
|
|
/// A static symbol that can be safely converted into a [`QName`] without
|
|
|
|
/// any checks.
|
|
|
|
///
|
|
|
|
/// This must only be implemented on static symbol types that are known to
|
|
|
|
/// be valid QNames.
|
|
|
|
pub trait QNameCompatibleStaticSymbolId: StaticSymbolId {}
|
|
|
|
|
|
|
|
impl QNameCompatibleStaticSymbolId for CIdentStaticSymbolId {}
|
|
|
|
impl QNameCompatibleStaticSymbolId for TameIdentStaticSymbolId {}
|
|
|
|
|
|
|
|
#[doc(hidden)]
|
2022-06-14 17:00:12 -04:00
|
|
|
// rustfmt is over-indenting the doc annotations at the time of writing.
|
|
|
|
#[rustfmt::skip]
|
2022-06-03 14:34:08 -04:00
|
|
|
macro_rules! qname_const_inner {
|
|
|
|
($name:ident = :$local:ident) => {
|
2022-06-14 17:00:12 -04:00
|
|
|
#[doc=concat!(
|
|
|
|
"QName with no namespace prefix and local name [`",
|
|
|
|
stringify!($local),
|
|
|
|
"`].",
|
|
|
|
)]
|
2022-06-03 14:34:08 -04:00
|
|
|
pub const $name: crate::xir::QName =
|
|
|
|
crate::xir::QName::st_cid_local(&$local);
|
|
|
|
};
|
|
|
|
|
|
|
|
($name:ident = $prefix:ident:$local:ident) => {
|
2022-06-14 17:00:12 -04:00
|
|
|
#[doc=concat!(
|
|
|
|
"QName with namespace prefix [`",
|
|
|
|
stringify!($prefix),
|
|
|
|
"`] and local name [`",
|
|
|
|
stringify!($local),
|
|
|
|
"`].",
|
|
|
|
)]
|
2022-06-03 14:34:08 -04:00
|
|
|
pub const $name: crate::xir::QName =
|
|
|
|
crate::xir::QName::st_cid(&$prefix, &$local);
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
/// Construct a series of [`QName`] constants.
|
|
|
|
///
|
|
|
|
/// The syntax for each constant is `NAME: [PREFIX]:LOCAL`,
|
|
|
|
/// where `PREFIX` is optional.
|
|
|
|
///
|
|
|
|
/// See [`crate::sym::st`] for usable symbol constants.
|
|
|
|
macro_rules! qname_const {
|
|
|
|
($($name:ident: $($prefix:ident)? : $local:ident,)*) => {
|
|
|
|
$(
|
|
|
|
qname_const_inner!($name = $($prefix)?:$local);
|
|
|
|
)*
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
qname_const! {
|
tamer: xir::parse::ele: Initial element parser generator concept
This begins generating parsers that are capable of parsing elements. I need
to move on, so this abstraction isn't going to go as far as it could, but
let's see where it takes me.
This was the work that required the recent lookahead changes, which has been
detailed in previous commits.
This initial support is basic, but robust. It supports parsing elements
with attributes and children, but it does not yet support the equivalent of
the Kleene star (`*`). Such support will likely be added by supporting
parsers that are able to recurse on their own definition in tail position,
which will also require supporting parsers that do not add to the stack.
This generates parsers that, like all the other parsers, use enums to
provide a typed stack. Stitched parsers produce a nested stack that is
always bounded in size. Fortunately, expressions---which can nest
deeply---do not need to maintain ancestor context on the stack, and so this
should work fine; we can get away with this because XIRF ensures proper
nesting for us. Statements that _do_ need to maintain such context are not
nested.
This also does not yet support emitting an object on closing tag, which
will be necessary for NIR, which will be a streaming IR that is "near" to
the source XML in structure. This will then be used to lower into AIR for
the ASG, which gives structure needed for further analysis.
More information to come; I just want to get this committed to serve as a
mental synchronization point and clear my head, since I've been sitting on
these changes for so long and have to keep stashing them as I tumble down
rabbit holes covered in yak hair.
DEV-7145
2022-07-13 13:55:32 -04:00
|
|
|
QN_CLASSIFY: :L_CLASSIFY,
|
2022-06-03 14:34:08 -04:00
|
|
|
QN_DESC: :L_DESC,
|
|
|
|
QN_DIM: :L_DIM,
|
|
|
|
QN_DTYPE: :L_DTYPE,
|
|
|
|
QN_ELIG_CLASS_YIELDS: L_PREPROC:L_ELIG_CLASS_YIELDS,
|
tamer: xir::parse::ele: Initial element parser generator concept
This begins generating parsers that are capable of parsing elements. I need
to move on, so this abstraction isn't going to go as far as it could, but
let's see where it takes me.
This was the work that required the recent lookahead changes, which has been
detailed in previous commits.
This initial support is basic, but robust. It supports parsing elements
with attributes and children, but it does not yet support the equivalent of
the Kleene star (`*`). Such support will likely be added by supporting
parsers that are able to recurse on their own definition in tail position,
which will also require supporting parsers that do not add to the stack.
This generates parsers that, like all the other parsers, use enums to
provide a typed stack. Stitched parsers produce a nested stack that is
always bounded in size. Fortunately, expressions---which can nest
deeply---do not need to maintain ancestor context on the stack, and so this
should work fine; we can get away with this because XIRF ensures proper
nesting for us. Statements that _do_ need to maintain such context are not
nested.
This also does not yet support emitting an object on closing tag, which
will be necessary for NIR, which will be a streaming IR that is "near" to
the source XML in structure. This will then be used to lower into AIR for
the ASG, which gives structure needed for further analysis.
More information to come; I just want to get this committed to serve as a
mental synchronization point and clear my head, since I've been sitting on
these changes for so long and have to keep stashing them as I tumble down
rabbit holes covered in yak hair.
DEV-7145
2022-07-13 13:55:32 -04:00
|
|
|
QN_EXPORT: :L_EXPORT,
|
2022-06-03 14:34:08 -04:00
|
|
|
QN_EXTERN: :L_EXTERN,
|
|
|
|
QN_FRAGMENT: L_PREPROC:L_FRAGMENT,
|
|
|
|
QN_FRAGMENTS: L_PREPROC:L_FRAGMENTS,
|
|
|
|
QN_FROM: L_PREPROC:L_FROM,
|
|
|
|
QN_GENERATED: L_PREPROC:L_GENERATED,
|
|
|
|
QN_ID: :L_ID,
|
|
|
|
QN_ISOVERRIDE: :L_ISOVERRIDE,
|
|
|
|
QN_LV_PACKAGE: L_LV:L_PACKAGE,
|
|
|
|
QN_L_DEP: L_L:L_DEP,
|
|
|
|
QN_L_EXEC: L_L:L_EXEC,
|
|
|
|
QN_L_FROM: L_L:L_FROM,
|
|
|
|
QN_L_MAP_EXEC: L_L:L_MAP_EXEC,
|
|
|
|
QN_L_MAP_FROM: L_L:L_MAP_FROM,
|
|
|
|
QN_L_RETMAP_EXEC: L_L:L_RETMAP_EXEC,
|
|
|
|
QN_L_STATIC: L_L:L_STATIC,
|
|
|
|
QN_NAME: :L_NAME,
|
|
|
|
QN_PACKAGE: :L_PACKAGE,
|
|
|
|
QN_PARENT: :L_PARENT,
|
|
|
|
QN_PROGRAM: :L_PROGRAM,
|
|
|
|
QN_P_SYM: L_PREPROC:L_SYM,
|
|
|
|
QN_SRC: :L_SRC,
|
|
|
|
QN_SYM: L_PREPROC:L_SYM,
|
|
|
|
QN_SYMTABLE: L_PREPROC:L_SYMTABLE,
|
|
|
|
QN_SYM_DEP: L_PREPROC:L_SYM_DEP,
|
|
|
|
QN_SYM_DEPS: L_PREPROC:L_SYM_DEPS,
|
|
|
|
QN_SYM_REF: L_PREPROC:L_SYM_REF,
|
|
|
|
QN_TITLE: :L_TITLE,
|
|
|
|
QN_TYPE: :L_TYPE,
|
|
|
|
QN_UUROOTPATH: :L_UUROOTPATH,
|
tamer: xir::parse::ele: Initial element parser generator concept
This begins generating parsers that are capable of parsing elements. I need
to move on, so this abstraction isn't going to go as far as it could, but
let's see where it takes me.
This was the work that required the recent lookahead changes, which has been
detailed in previous commits.
This initial support is basic, but robust. It supports parsing elements
with attributes and children, but it does not yet support the equivalent of
the Kleene star (`*`). Such support will likely be added by supporting
parsers that are able to recurse on their own definition in tail position,
which will also require supporting parsers that do not add to the stack.
This generates parsers that, like all the other parsers, use enums to
provide a typed stack. Stitched parsers produce a nested stack that is
always bounded in size. Fortunately, expressions---which can nest
deeply---do not need to maintain ancestor context on the stack, and so this
should work fine; we can get away with this because XIRF ensures proper
nesting for us. Statements that _do_ need to maintain such context are not
nested.
This also does not yet support emitting an object on closing tag, which
will be necessary for NIR, which will be a streaming IR that is "near" to
the source XML in structure. This will then be used to lower into AIR for
the ASG, which gives structure needed for further analysis.
More information to come; I just want to get this committed to serve as a
mental synchronization point and clear my head, since I've been sitting on
these changes for so long and have to keep stashing them as I tumble down
rabbit holes covered in yak hair.
DEV-7145
2022-07-13 13:55:32 -04:00
|
|
|
QN_VALUE: :L_VALUE,
|
2022-06-03 14:34:08 -04:00
|
|
|
QN_VIRTUAL: :L_VIRTUAL,
|
|
|
|
QN_XMLNS: :L_XMLNS,
|
|
|
|
QN_XMLNS_L: L_XMLNS:L_L,
|
|
|
|
QN_XMLNS_PREPROC: L_XMLNS:L_PREPROC,
|
|
|
|
QN_YIELDS: :L_YIELDS,
|
|
|
|
}
|
|
|
|
}
|