Hyperiso 1.0.3
Modular flavour-physics calculations, Wilson coefficients and statistical inference
Loading...
Searching...
No Matches
LhaParser.h File Reference

Parser for LHA / FLHA-style files into LhaBlock structures and DBNode trees. More...

#include <string>
#include <map>
#include <memory>
#include <filesystem>
#include <climits>
#include <regex>
#include <fstream>
#include <sstream>
#include <vector>
#include <algorithm>
#include <unordered_set>
#include <iomanip>
#include "Include.h"
#include "LhaBlockPrototype.h"
#include "IParser.h"
#include "lha_blocks.h"
#include "lha_elements.h"
#include "Logger.h"
#include "DBNode.h"
Include dependency graph for LhaParser.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  Token
 Single lexical token produced from an LHA file. More...
 
class  LhaParser
 Parser for LHA/FLHA files, producing blocks and a DBNode representation. More...
 

Enumerations

enum class  TokenType {
  FLOAT , INTEGER , BLOCK , DECAY ,
  NEWLINE , SKIP , COMMENT , WORD ,
  OTHER
}
 Token categories used during LHA lexical analysis. More...
 

Functions

const std::regex analyzer_rx (R"x(((?:[+-])?(?:\d+\.\d*|\.\d+)(?:[eEdD][+-]\d+)?|(\d+(?:[eEdD][+-]\d+)?))|(?:[+-]?\d+(?!\.))|(block)|(decay)|(\n)|([ \t]+)|(#.*)|([\w\=\.]+)|([^#]*))x", std::regex_constants::icase)
 

Detailed Description

Parser for LHA / FLHA-style files into LhaBlock structures and DBNode trees.

LhaParser decodes a textual LHA (or FLHA) file into:

  • a set of LhaBlock objects (one per block),
  • then a DBNode tree suitable for use by the rest of the framework.

It uses:

  • a regex-based tokenizer,
  • a simple state machine to group tokens by block,
  • a set of Prototype descriptors to interpret each block's layout.

Definition in file LhaParser.h.

Enumeration Type Documentation

◆ TokenType

enum class TokenType
strong

Token categories used during LHA lexical analysis.

The order of the enum values is tightly coupled to the capturing groups of the regular expression analyzer_rx. Changing one requires updating the other accordingly.

Enumerator
FLOAT 

Floating point number.

INTEGER 

Integer number.

BLOCK 

Block keyword.

DECAY 

Decay keyword.

NEWLINE 

Newline character.

SKIP 

Whitespace character.

COMMENT 

Comment line.

WORD 

Word token.

OTHER 

Other types of tokens.

Definition at line 47 of file LhaParser.h.

Function Documentation

◆ analyzer_rx()

const std::regex analyzer_rx ( R"x(((?:[+-])?(?:\d+\.\d*|\.\d+)(?:[eEdD][+-]\d+)?|(\d+(?:[eEdD][+-]\d+)?))|(?:[+-]?\d+(?!\.))|(block)|(decay)|(\n)|([ \t]+)|(#.*)|([\w\=\.]+)|([^#]*))x"  ,
std::regex_constants::icase   
)