![]() |
undoStudio
The IDE of the undoRT ecosystem
|
Namespaces | |
| namespace | detail |
Classes | |
| struct | CallSignature |
| The parameter list of a callable. More... | |
| struct | CallSite |
| The call the cursor sits inside, if any. More... | |
| struct | Declaration |
| One declaration that a usage can be navigated back to. More... | |
| struct | FileNode |
| Node structure for the file tree representation. More... | |
| struct | MemberAccessPoint |
| What a line looks like at the cursor, for member completion. More... | |
| struct | MethodData |
| Data structure for a method inside a FUNCTION_BLOCK. More... | |
| struct | MethodEditors |
| Editor pair for a single METHOD tab (created lazily on first open) More... | |
| struct | NameMatch |
| How a typed pattern lines up with a candidate name. More... | |
| struct | OutputFilter |
| Which severities the Output panel shows. More... | |
| struct | OutputLine |
| One tagged line in the Output panel. More... | |
| struct | SemanticToken |
| One classified identifier occurrence. More... | |
| struct | SemanticTokenSet |
| Result of a classification pass. More... | |
| struct | SignatureParam |
| One parameter of a call, as the signature popup shows it. More... | |
| struct | SignatureSegment |
| One run of text in a rendered signature. More... | |
| struct | SourceSegment |
| One editor-backed block of the generated ST file. More... | |
| class | STApp |
| Main application class for the Structured Text editor plugin. More... | |
| struct | StatementSnippet |
| One statement skeleton the suggestion list can write out. More... | |
| struct | STDocument |
| One open ST file, held whole so it can be put back. More... | |
| struct | Suggestion |
| One entry of a completion list. More... | |
Typedefs | |
| using | TranslationUnit = ::TranslationUnit |
| using | ParseError = ::ParseError |
| using | DeclarationIndex = std::unordered_map< std::string, std::vector< Declaration > > |
| Declarations of a translation unit, keyed by normalized name. | |
| using | MemberAccess = Suggestion |
| using | MemberList = std::vector< Suggestion > |
Enumerations | |
| enum class | POUType { Program , FunctionBlock , Function } |
| Enumeration of POU (Program Organization Unit) types. More... | |
| enum class | OutSeverity { Info , Success , Warning , Error } |
| Severity of a line in the Output panel. More... | |
| enum class | SymCategory { Unresolved , Variable , Constant , Parameter , Function , Type , Field , Enumerator } |
| Category of a resolved symbol, as far as highlighting cares. More... | |
| enum class | SnippetPane { Variables , Body } |
| The pane a snippet is written into. More... | |
Functions | |
| std::vector< OutputLine > | searchOutput (const std::vector< OutputLine > &lines, const std::string &needle) |
| The lines matching a substring, for the panel's search box. | |
| bool | isCountSummary (const std::string &line) |
| Whether a line from the transpiler is a tally rather than a diagnostic. | |
| OutSeverity | classifyCompilerLine (const std::string &line) |
| How a line the transpiler printed should be coloured in the panel. | |
| SemanticTokenSet | 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 | 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 | describeType (const TypeRef &type) |
| Render a type reference the way it is written in source. | |
| DeclarationIndex | collectDeclarations (const TranslationUnit &tu, const st2cpp::semantic::SymbolTable &symTab) |
| Index every declaration a navigation could target. | |
| NameMatch | matchName (const std::string &name, const std::string &pattern) |
| Match a typed pattern against a candidate name, fuzzily. | |
| void | rankMembers (MemberList &members, const std::string &pattern) |
| Keep the members a pattern matches and order them best first. | |
| MemberList | collectBlockMembers (const st2cpp::semantic::SymbolTable &symTab, st2cpp::semantic::SymbolId fbId) |
| Everything reachable through '.' on a value of a function block type. | |
| st2cpp::semantic::SymbolId | 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 | memberAccessPointAt (const std::string &line, int cursorCol) |
| Decide whether the cursor sits in a member access. | |
| std::string | describeMember (const Suggestion &member) |
| Render a member the way it is offered in the completion list. | |
| MemberList | 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 | callSiteAt (const std::vector< std::string > &lines, int line, int col) |
| Find the call whose argument list the cursor is inside. | |
| bool | 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 > | signatureSegments (const CallSignature &signature, int activeArgument) |
| Break a signature into the runs the popup draws. | |
| std::string | formatSignature (const CallSignature &signature, int activeArgument) |
| Render a signature as one line, the way the tests and the label use it. | |
| const std::vector< StatementSnippet > & | allStatementSnippets () |
| The statements on offer. | |
| std::vector< StatementSnippet > | snippetsForPane (SnippetPane pane) |
| The snippets belonging to one pane. | |
| bool | hasStatementPrefix (const std::string &prefix) |
| Whether the list is worth opening for what has been typed. | |
| std::string | statementPrefixAt (const std::string &line, int column, int &startCol) |
| The word being typed at the caret. | |
| void | rankSnippets (std::vector< StatementSnippet > &snippets, const std::string &prefix) |
| Keep the snippets matching a prefix, best match first. | |
| std::string | leadingWhitespace (const std::string &line) |
| Indentation of a line, spaces and tabs alike. | |
| void | expandSnippet (const StatementSnippet &snippet, const std::string &base, const std::string &tab, std::string &text, int &caretLine, int &caretCol) |
| Write a snippet out at a line, in the indentation already in force there. | |
| using undoApp::ST::DeclarationIndex = typedef std::unordered_map<std::string, std::vector<Declaration> > |
Declarations of a translation unit, keyed by normalized name.
A name can appear more than once when a METHOD parameter shadows a POU variable, so every declaration is kept and the caller picks the one matching the scope it is navigating from.
| using undoApp::ST::MemberAccess = typedef Suggestion |
The name a member-completion candidate used to be known by. Kept so callers and tests that only deal with members keep reading correctly.
| using undoApp::ST::MemberList = typedef std::vector<Suggestion> |
| using undoApp::ST::ParseError = typedef ::ParseError |
| using undoApp::ST::TranslationUnit = typedef ::TranslationUnit |
|
strong |
Severity of a line in the Output panel.
| Enumerator | |
|---|---|
| Info | Debug/detail output, and the generated ST dump. |
| Success | Confirmation that a step succeeded. |
| Warning | Reported by the analyzer but not blocking. |
| Error | Blocks code generation. |
|
strong |
|
strong |
|
strong |
Category of a resolved symbol, as far as highlighting cares.
| const std::vector< StatementSnippet > & undoApp::ST::allStatementSnippets | ( | ) |
The statements on offer.
| CallSite undoApp::ST::callSiteAt | ( | const std::vector< std::string > & | lines, |
| int | line, | ||
| int | col | ||
| ) |
Find the call whose argument list the cursor is inside.
| lines | Text of the buffer, one entry per line |
| line | 0-based line of the cursor |
| col | 0-based column of the cursor |
active false when the cursor is not inside oneThe scan walks backwards over the whole buffer, so a call split over several lines still resolves. It skips string literals, line comments and block comments, and stops at a ;, which is what keeps a ( from an earlier statement from being attributed to the current one.
|
inline |
How a line the transpiler printed should be coloured in the panel.
The transpiler writes to standard error in a fixed shape, which is what this reads. Matching the bare word "error" anywhere in the line is what marked a count of zero errors as an error, and what would mark a file called errors.st as a failure.
A tally is Info: it reports what the lines above it already said, each of which is coloured on its own, so colouring the summary as well puts one more red line in among the red ones and hides the ones that matter.
| MemberList undoApp::ST::collectBlockMembers | ( | const st2cpp::semantic::SymbolTable & | symTab, |
| st2cpp::semantic::SymbolId | fbId | ||
| ) |
Everything reachable through '.' on a value of a function block type.
| symTab | Symbol table of the analysis the instance belongs to |
| fbId | Symbol id of the FUNCTION_BLOCK |
The base chain comes first so the listing matches the block's declaration order, and an entry a derived block redeclares appears once, as the derived declaration. Empty when fbId is not a function block.
| DeclarationIndex undoApp::ST::collectDeclarations | ( | const TranslationUnit & | tu, |
| const st2cpp::semantic::SymbolTable & | symTab | ||
| ) |
Index every declaration a navigation could target.
| tu | Parsed translation unit |
| symTab | Symbol table for that unit, used to classify each declaration |
| 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.
| symTab | Symbol table of the file being edited |
| scopeId | Scope the caret is in |
| includeOwnMethods | Also offer the methods of the block being edited |
A name is offered when the source could resolve it from where the caret is: the scopes from that point outwards, plus the library side. The block's own methods are part of that only in its own body, since a method reaches its siblings through an instance rather than by name. Inside a scope the order is declaration order, and a name declared in more than one place appears once, as the innermost declaration, which is the one that wins in the source.
| 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.
| tu | Parsed translation unit |
| symTab | Symbol table produced by SemanticAnalyzer for that same unit |
| srcLines | Generated source, 1-based (index 0 holds line 1) |
The analyzer does not write symbol ids back into the AST, and POU/METHOD members live in scopes unreachable from the global one, so visibility is resolved by name against a per-scope index built here. A few nodes (POU and METHOD names, STRUCT members) carry no position at all and are located in the source text.
| std::string undoApp::ST::describeMember | ( | const Suggestion & | member | ) |
Render a member the way it is offered in the completion list.
| member | Member to describe |
| std::string undoApp::ST::describeType | ( | const TypeRef & | type | ) |
Render a type reference the way it is written in source.
| type | Type reference from the AST |
| void undoApp::ST::expandSnippet | ( | const StatementSnippet & | snippet, |
| const std::string & | base, | ||
| const std::string & | tab, | ||
| std::string & | text, | ||
| int & | caretLine, | ||
| int & | caretCol | ||
| ) |
Write a snippet out at a line, in the indentation already in force there.
The base indentation of the line the caret is on is prepended to every template line, so a skeleton accepted inside a loop comes out indented like the code around it. The caret is resolved against the written text, where an indent step is as wide as the editor shows a tab.
| snippet | Skeleton to write |
| base | Indentation to insert under |
| tab | Text standing for one indent step |
| text | Set to the text to write, newlines included |
| caretLine | Set to the line the caret belongs on, 0-based in the text |
| caretCol | Set to the column it belongs at, 0-based in that line |
| 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.
| symTab | Symbol table of the current analysis |
| scopeId | Scope the lookup starts from, e.g. a METHOD's scope |
| name | Instance name as written in the source |
An instance is a variable whose type resolved to a function block, which is how inst : Motor becomes a member provider. External instances (a block declared in a sibling file) resolve too, once the descriptor carries its members.
| 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.
| symTab | Symbol table of the current analysis |
| ownerName | POU or METHOD name, as spelled in the source |
| method | True for a METHOD, false for a POU |
st2cpp names these scopes after their owner ("FB_Motor", "METHOD_Reset"). A METHOD scope is nested inside its POU's, so a name visible in the METHOD is also found by walking up from here.
| 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.
| signature | What resolveCallSignature produced |
| activeArgument | Argument the cursor is in, 0-based |
| bool undoApp::ST::hasStatementPrefix | ( | const std::string & | prefix | ) |
Whether the list is worth opening for what has been typed.
The gate is stricter than the matching rankSnippets does. Matching inside the list is a subsequence, so "end" finds every END_ and "wh" finds WHILE, but "re" is also a subsequence match for REPEAT while the user is halfway through "reSetFlag" or "motore.re". The list only opens when the word is a genuine prefix of a keyword, which leaves an identifier that happens to begin like a statement to the identifier list.
| prefix | What the user has typed |
|
inline |
Whether a line from the transpiler is a tally rather than a diagnostic.
st2cpp closes its diagnostics with a count of what it just reported: 3 error(s), 2 warning(s) generated. Semantic analysis: 0 errors, 3 warnings The word "error" is in those lines, and taking it at its word marks a summary of zero errors as an error. What tells them apart from a real diagnostic is that a number sits immediately in front of the word: a diagnostic names its position instead, as "file.st:12:5: error:", where a colon comes between.
| std::string undoApp::ST::leadingWhitespace | ( | const std::string & | line | ) |
Indentation of a line, spaces and tabs alike.
| line | Line to measure |
| NameMatch undoApp::ST::matchName | ( | const std::string & | name, |
| const std::string & | pattern | ||
| ) |
Match a typed pattern against a candidate name, fuzzily.
| name | Candidate name as spelled in the source |
| pattern | What the user has typed so far |
positions empty when the pattern is emptyCase-insensitive, as IEC 61131-3 identifiers are, and tolerant of interleaved characters: rst matches Reset, Reset matches MotorResetState, and Reset does not match resets.
Ranking prefers, in order: the whole name, then a prefix, then a word boundary, then a plain in-order match. Within that, characters that continue a run, start a word or sit on a camel-case hump raise the score, and every skipped character lowers it slightly, so the tightest match sorts first.
| MemberAccessPoint undoApp::ST::memberAccessPointAt | ( | const std::string & | line, |
| int | cursorCol | ||
| ) |
Decide whether the cursor sits in a member access.
| line | Text of the current line |
| cursorCol | 0-based column of the cursor within that line |
active false when there is noneOnly an identifier (or nothing) may precede the '.', so a literal or a closing parenthesis does not open completion. The prefix is the identifier fragment already typed after the '.', which the caller filters on.
| void undoApp::ST::rankMembers | ( | MemberList & | members, |
| const std::string & | pattern | ||
| ) |
Keep the members a pattern matches and order them best first.
| members | List to filter in place |
| pattern | What the user has typed after the '.' |
Every surviving member gets its matchPositions filled, which is what the list draws highlighted. The sort is stable, so members that score equally keep the block's declaration order.
| void undoApp::ST::rankSnippets | ( | std::vector< StatementSnippet > & | snippets, |
| const std::string & | prefix | ||
| ) |
Keep the snippets matching a prefix, best match first.
Matching is a subsequence, not a prefix, so "fi" still finds IF and "wh" finds WHILE. Best match is where the match begins: a label opening with what was typed is about that word, one that only contains it further along is not. That is what puts END_IF ahead of IF ... END_IF once "end" has been typed. Snippets that score alike keep the order the table is written in.
| snippets | In/out list, reordered in place |
| prefix | What the user has typed |
| 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.
| symTab | Symbol table of the current analysis |
| scopeId | Scope the lookup starts from, so a METHOD local wins |
| call | The call site to resolve |
| out | Filled with the signature on success, untouched on failure |
Handles the three shapes a call takes in ST: a method through an instance (inst.Method(), a FUNCTION or a FUNCTION_BLOCK instance called directly (MyBlock(), and a POU reached through its type name. A METHOD is looked up over the whole EXTENDS chain, since the block may not declare it itself.
|
inline |
The lines matching a substring, for the panel's search box.
Empty or whitespace-only text matches everything, so clearing the box restores the list without a second way to say "no search".
| std::vector< SignatureSegment > undoApp::ST::signatureSegments | ( | const CallSignature & | signature, |
| int | activeArgument | ||
| ) |
Break a signature into the runs the popup draws.
| signature | What resolveCallSignature produced |
| activeArgument | Argument the cursor is in, 0-based |
A parameter count that has run past the last one still yields a run, so the popup can flag an argument the callee does not take.
| std::vector< StatementSnippet > undoApp::ST::snippetsForPane | ( | SnippetPane | pane | ) |
The snippets belonging to one pane.
| pane | Pane the caret is in |
| std::string undoApp::ST::statementPrefixAt | ( | const std::string & | line, |
| int | column, | ||
| int & | startCol | ||
| ) |
The word being typed at the caret.
| line | The line the caret is on |
| column | Caret column, 0-based |
| startCol | Set to the first column of the word |
The word has to end at the caret. A caret inside one is editing it, and replacing "IF" with a skeleton there would leave "IF" welded to what followed.