OpenClonk
C4AulParseError Class Reference

#include <C4Aul.h>

Inheritance diagram for C4AulParseError:
[legend]
Collaboration diagram for C4AulParseError:
[legend]

Public Member Functions

 C4AulParseError (C4ScriptHost *pScript, const char *pMsg)
 
 C4AulParseError (class C4AulParse *state, const char *pMsg)
 
 C4AulParseError (C4AulScriptFunc *Fn, const char *SPos, const char *pMsg)
 
const char * what () const noexcept override
 

Protected Attributes

StdCopyStrBuf sMessage
 

Detailed Description

Definition at line 52 of file C4Aul.h.

Constructor & Destructor Documentation

◆ C4AulParseError() [1/3]

C4AulParseError::C4AulParseError ( C4ScriptHost pScript,
const char *  pMsg 
)

Definition at line 202 of file C4AulParse.cpp.

References StdStrBuf::getData(), and C4ScriptHost::ScriptName.

203 {
204  // compose error string
205  sMessage.Copy(pMsg);
206  if (pScript)
207  {
208  // Script name
209  sMessage.AppendFormat(" (%s)",
210  pScript->ScriptName.getData());
211  }
212 }
void AppendFormat(const char *szFmt,...) GNUC_FORMAT_ATTRIBUTE_O
Definition: StdBuf.cpp:190
const char * getData() const
Definition: StdBuf.h:442
void Copy()
Definition: StdBuf.h:467
StdCopyStrBuf ScriptName
Definition: C4ScriptHost.h:57
StdCopyStrBuf sMessage
Definition: C4Aul.h:44
Here is the call graph for this function:

◆ C4AulParseError() [2/3]

C4AulParseError::C4AulParseError ( class C4AulParse state,
const char *  pMsg 
)

Definition at line 195 of file C4AulParse.cpp.

196 {
197  // compose error string
198  sMessage.Copy(pMsg);
199  state->AppendPosition(sMessage);
200 }
void Copy()
Definition: StdBuf.h:467
StdCopyStrBuf sMessage
Definition: C4Aul.h:44

◆ C4AulParseError() [3/3]

C4AulParseError::C4AulParseError ( C4AulScriptFunc Fn,
const char *  SPos,
const char *  pMsg 
)

Definition at line 214 of file C4AulParse.cpp.

References StdStrBuf::getData(), C4AulFunc::GetName(), C4ScriptHost::GetScript(), C4AulScriptFunc::pOrgScript, C4ScriptHost::ScriptName, SGetLine(), and SLineGetCharacters().

215 {
216  // compose error string
217  sMessage.Copy(pMsg);
218  if (!Fn) return;
219  sMessage.Append(" (");
220  // Show function name
221  if (Fn->GetName())
222  sMessage.AppendFormat("in %s", Fn->GetName());
223  if (Fn->GetName() && Fn->pOrgScript && SPos)
224  sMessage.Append(", ");
225  // Exact position
226  if (Fn->pOrgScript && SPos)
227  sMessage.AppendFormat("%s:%d:%d)",
229  SGetLine(Fn->pOrgScript->GetScript(), SPos),
230  SLineGetCharacters(Fn->pOrgScript->GetScript(), SPos));
231  else
232  sMessage.AppendChar(')');
233 }
const char * GetScript() const
Definition: C4ScriptHost.h:52
int SGetLine(const char *szText, const char *cpPosition)
Definition: Standard.cpp:473
C4ScriptHost * pOrgScript
const char * GetName() const
Definition: C4AulFunc.h:56
int SLineGetCharacters(const char *szText, const char *cpPosition)
Definition: Standard.cpp:485
void AppendFormat(const char *szFmt,...) GNUC_FORMAT_ATTRIBUTE_O
Definition: StdBuf.cpp:190
void AppendChar(char cChar)
Definition: StdBuf.h:588
void Append(const char *pnData, size_t iChars)
Definition: StdBuf.h:519
const char * getData() const
Definition: StdBuf.h:442
void Copy()
Definition: StdBuf.h:467
StdCopyStrBuf ScriptName
Definition: C4ScriptHost.h:57
StdCopyStrBuf sMessage
Definition: C4Aul.h:44
Here is the call graph for this function:

Member Function Documentation

◆ what()

const char * C4AulError::what ( ) const
overridenoexceptinherited

Definition at line 59 of file C4Aul.cpp.

Referenced by C4PropList::Call(), C4AulFunc::CheckParTypes(), C4AulExec::ClearPointers(), C4AulExec::DirectExec(), C4AulCompiler::ConstexprEvaluator::eval(), C4AulCompiler::ConstexprEvaluator::eval_static(), C4AulScriptEngine::Link(), C4AulCompiler::PreparseAstVisitor::visit(), and C4AulCompiler::ConstantResolver::visit().

60 {
61  return sMessage ? sMessage.getData() : "(unknown error)";
62 }
const char * getData() const
Definition: StdBuf.h:442
StdCopyStrBuf sMessage
Definition: C4Aul.h:44
Here is the caller graph for this function:

Member Data Documentation

◆ sMessage

StdCopyStrBuf C4AulError::sMessage
protectedinherited

Definition at line 44 of file C4Aul.h.

Referenced by C4AulExecError::C4AulExecError().


The documentation for this class was generated from the following files: