MCPcopy Create free account
hub / github.com/anjo76/angelscript / SkipStatement

Method SkipStatement

sdk/add_on/scriptbuilder/scriptbuilder.cpp:807–843  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

805}
806
807int CScriptBuilder::SkipStatement(int pos)
808{
809 asUINT len = 0;
810
811 // Skip until ; or { whichever comes first
812 while( pos < (int)modifiedScript.length() && modifiedScript[pos] != ';' && modifiedScript[pos] != '{' )
813 {
814 engine->ParseToken(&modifiedScript[pos], modifiedScript.size() - pos, &len);
815 pos += len;
816 }
817
818 // Skip entire statement block
819 if( pos < (int)modifiedScript.length() && modifiedScript[pos] == '{' )
820 {
821 pos += 1;
822
823 // Find the end of the statement block
824 int level = 1;
825 while( level > 0 && pos < (int)modifiedScript.size() )
826 {
827 asETokenClass t = engine->ParseToken(&modifiedScript[pos], modifiedScript.size() - pos, &len);
828 if( t == asTC_KEYWORD )
829 {
830 if( modifiedScript[pos] == '{' )
831 level++;
832 else if( modifiedScript[pos] == '}' )
833 level--;
834 }
835
836 pos += len;
837 }
838 }
839 else
840 pos += 1;
841
842 return pos;
843}
844
845// Overwrite all code with blanks until the matching #endif
846int CScriptBuilder::ExcludeCode(int pos)

Callers

nothing calls this directly

Calls 3

lengthMethod · 0.45
ParseTokenMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected