undoStudio
The IDE of the undoRT ecosystem
Loading...
Searching...
No Matches
undoAppSTSemantic.hpp File Reference

Resolved-symbol extraction for ST syntax highlighting. More...

#include "ast/AST.h"
#include "semantic/SymbolTable.h"
#include <functional>
#include <string>
#include <unordered_map>
#include <vector>
Include dependency graph for undoAppSTSemantic.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  undoApp::ST::SemanticToken
 One classified identifier occurrence. More...
 
struct  undoApp::ST::SemanticTokenSet
 Result of a classification pass. More...
 
struct  undoApp::ST::Declaration
 One declaration that a usage can be navigated back to. More...
 
struct  undoApp::ST::NameMatch
 How a typed pattern lines up with a candidate name. More...
 
struct  undoApp::ST::Suggestion
 One entry of a completion list. More...
 
struct  undoApp::ST::MemberAccessPoint
 What a line looks like at the cursor, for member completion. More...
 
struct  undoApp::ST::CallSite
 The call the cursor sits inside, if any. More...
 
struct  undoApp::ST::SignatureParam
 One parameter of a call, as the signature popup shows it. More...
 
struct  undoApp::ST::CallSignature
 The parameter list of a callable. More...
 
struct  undoApp::ST::SignatureSegment
 One run of text in a rendered signature. More...
 

Namespaces

namespace  undoApp
 
namespace  undoApp::ST
 

Typedefs

using undoApp::ST::DeclarationIndex = std::unordered_map< std::string, std::vector< Declaration > >
 Declarations of a translation unit, keyed by normalized name.
 
using undoApp::ST::MemberAccess = Suggestion
 
using undoApp::ST::MemberList = std::vector< Suggestion >
 

Enumerations

enum class  undoApp::ST::SymCategory {
  undoApp::ST::Unresolved , undoApp::ST::Variable , undoApp::ST::Constant , undoApp::ST::Parameter ,
  undoApp::ST::Function , undoApp::ST::Type , undoApp::ST::Field , undoApp::ST::Enumerator
}
 Category of a resolved symbol, as far as highlighting cares. More...
 

Functions

SemanticTokenSet undoApp::ST::collectSemanticTokens (const TranslationUnit &tu, const st2cpp::semantic::SymbolTable &symTab, const std::vector< std::string > &srcLines)
 Classify every identifier the analyzer could resolve.
 
st2cpp::semantic::ScopeId undoApp::ST::findMemberScopeFor (const st2cpp::semantic::SymbolTable &symTab, const std::string &ownerName, bool method)
 The scope holding the variables of a POU or the locals of a METHOD.
 
std::string undoApp::ST::describeType (const TypeRef &type)
 Render a type reference the way it is written in source.
 
DeclarationIndex undoApp::ST::collectDeclarations (const TranslationUnit &tu, const st2cpp::semantic::SymbolTable &symTab)
 Index every declaration a navigation could target.
 
NameMatch undoApp::ST::matchName (const std::string &name, const std::string &pattern)
 Match a typed pattern against a candidate name, fuzzily.
 
void undoApp::ST::rankMembers (MemberList &members, const std::string &pattern)
 Keep the members a pattern matches and order them best first.
 
MemberList undoApp::ST::collectBlockMembers (const st2cpp::semantic::SymbolTable &symTab, st2cpp::semantic::SymbolId fbId)
 Everything reachable through '.' on a value of a function block type.
 
st2cpp::semantic::SymbolId undoApp::ST::findInstanceBlock (const st2cpp::semantic::SymbolTable &symTab, st2cpp::semantic::ScopeId scopeId, const std::string &name)
 The function block an instance name refers to, if any.
 
MemberAccessPoint undoApp::ST::memberAccessPointAt (const std::string &line, int cursorCol)
 Decide whether the cursor sits in a member access.
 
std::string undoApp::ST::describeMember (const Suggestion &member)
 Render a member the way it is offered in the completion list.
 
MemberList undoApp::ST::collectScopeNames (const st2cpp::semantic::SymbolTable &symTab, st2cpp::semantic::ScopeId scopeId, bool includeOwnMethods=true)
 The names visible from a scope, for completing a plain identifier.
 
CallSite undoApp::ST::callSiteAt (const std::vector< std::string > &lines, int line, int col)
 Find the call whose argument list the cursor is inside.
 
bool undoApp::ST::resolveCallSignature (const st2cpp::semantic::SymbolTable &symTab, st2cpp::semantic::ScopeId scopeId, const CallSite &call, CallSignature &out)
 Resolve the parameters of the call at a call site.
 
std::vector< SignatureSegment > undoApp::ST::signatureSegments (const CallSignature &signature, int activeArgument)
 Break a signature into the runs the popup draws.
 
std::string undoApp::ST::formatSignature (const CallSignature &signature, int activeArgument)
 Render a signature as one line, the way the tests and the label use it.
 

Detailed Description

Resolved-symbol extraction for ST syntax highlighting.

Author
Salvatore Bamundo
Date
July 2026 SPDX-License-Identifier: GPL-3.0-or-later SPDX-FileCopyrightText: Copyright (c) 2026 undoRT

Turns a parsed TranslationUnit plus the st2cpp symbol table into a flat list of classified identifier tokens. Deliberately free of any UI dependency so the mapping (which identifier belongs to which category, at which position) can be exercised without a graphics context.

Coordinates are 1-based lines (as st2cpp reports them) and 0-based columns into the line, matching the editor's glyph indices.