Advertisement
Guest User

Untitled

a guest
Dec 17th, 2016
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #Lang "qb"
  2. Option Explicit
  3.  
  4. Const shaderfile = "repak-c.shader"
  5.  
  6. Dim brackets As Integer
  7. Dim inline As String
  8. Dim filehandle As Integer
  9. Dim Lnum As Long
  10.  
  11. filehandle = Freefile
  12.  
  13. Open shaderfile For Input As #filehandle
  14.  
  15.     Do Until Eof( filehandle )
  16.         lnum = lnum  + 1
  17.        
  18.         Line Input #filehandle, inline
  19.  
  20.         'check if all brackets were closed before a new shader starts'
  21.         If Left$( lcase$( inline ), 1 ) = "textures/"  And brackets > 0 Then  Goto abnormalexit
  22.        
  23.         'check opening brackets'
  24.         If Instr( 1, inline, "{" ) <> 0 And brackets <= 2 Then brackets = brackets + 1  
  25.        
  26.         'check closing brackets'
  27.         If Instr (1, inline, "}" ) <> 0 And brackets > 0  Then brackets = brackets - 1
  28.        
  29.         'check invalid bracket num'
  30.         If brackets < 0 Or brackets > 2 Then Goto abnormalexit
  31.     Loop
  32.  
  33. Close #filehandle
  34.  
  35. Print "all shaders parsed; no bracket mismatches found!"
  36. Sleep
  37. End
  38.  
  39. abnormalexit:
  40. Close #filehandle
  41. Print "error in line "; lnum ,  inline
  42. Sleep
  43. End
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement