فهرست منبع

Add BfParser_GetIndexAtLine

MineGame159 3 سال پیش
والد
کامیت
46fbca7668
2فایلهای تغییر یافته به همراه13 افزوده شده و 0 حذف شده
  1. 8 0
      IDE/src/Compiler/BfParser.bf
  2. 5 0
      IDEHelper/Compiler/BfParser.cpp

+ 8 - 0
IDE/src/Compiler/BfParser.bf

@@ -181,6 +181,9 @@ namespace IDE.Compiler
 		[CallingConvention(.Stdcall), CLink]
 		static extern void BfParser_GetLineCharAtIdx(void* bfParser, int32 idx, int32* line, int32* lineChar);
 
+        [CallingConvention(.Stdcall), CLink]
+        static extern int32 BfParser_GetIndexAtLine(void* bfParser, int32 line);
+
 		public BfSystem mSystem;
         public void* mNativeBfParser;
         public bool mIsUsed;
@@ -442,5 +445,10 @@ namespace IDE.Compiler
 
 			return (line, char);
 		}
+
+        public int GetIndexAtLine(int line)
+        {
+            return BfParser_GetIndexAtLine(mNativeBfParser, (.) line);
+        }
     }
 }

+ 5 - 0
IDEHelper/Compiler/BfParser.cpp

@@ -4200,4 +4200,9 @@ BF_EXPORT void BF_CALLTYPE BfParser_GetLineCharAtIdx(BfParser* bfParser, int idx
 
 	*line = _line;
 	*lineChar = _lineChar;
+}
+
+BF_EXPORT int BF_CALLTYPE BfParser_GetIndexAtLine(BfParser* bfParser, int line)
+{
+	return bfParser->GetIndexAtLine(line);
 }