nx_xbrl_lib.nx
buildroot/runtime/nx_xbrl_lib.nx
about
nx_xbrl_lib.nx -- F987: XBRL financial-fact parse + accounting-identity validation.
SEC filings are tagged in XBRL: <us-gaap:Assets contextRef=... unitRef=usd decimals=0>1000000</us-gaap:Assets>.
The sovereign property is that the parsed facts are CROSS-CHECKED against the accounting identity
(Assets == Liabilities + StockholdersEquity), so a mis-tagged or internally-inconsistent filing is
FLAGGED rather than fed blindly into a valuation. The same fail-closed discipline as the derived
statements: a balance sheet -- even one someone else prepared and tagged -- must balance, or it is
rejected. These parsed integers are exactly what feeds the distress (Altman Z) and stewardship engines
with GROUNDED numbers instead of hand-entered ones.
ATTRIBUTE-AWARE + NAMESPACE-AWARE by word boundary: matching <us-gaap:Assets checks the next byte is
'>' or whitespace, so it never mis-matches <us-gaap:AssetsCurrent>. That boundary check is the whole
correctness of a tag parser and it is done explicitly.
FAIL-CLOSED: a missing required fact is a rejection (a sentinel), not a zero -- a balance sheet with
no Assets tag is not a balance sheet with zero assets.
SCOPE (declared): parses fact text + validates the balance identity. Full XBRL (contexts, dimensions,
calculation linkbases, negative decimals scaling) is a declared follow-on. Values are whole units here.
DRY: composes nx_iso20022_lib (iso_find/iso_len). license_tier: ORIGINAL LIB.
dependencies 1 imports · 1 importers
imports: nx_iso20022_lib.nx
imported by: nx_xbrl_gate.nx
structs
| none |
consts
| 24 | const XB_NO_FACT: i64 = 0 - 999999999 // sentinel: a required fact is absent (fail-closed) |
functions
| 27 | func xb_atoi(s: *u8) -> i64 called by 1: xbrl_fact_int |
| 42 | func xbrl_fact(xml: *u8, xl: i64, concept: *u8, out: *u8) -> i64 |
| 91 | func xbrl_fact_int(xml: *u8, xl: i64, concept: *u8) -> i64 |
| 101 | func xbrl_check_balance(xml: *u8, xl: i64, out: *i64) -> i64 |