Loading ...
Sorry, an error occurred while loading the content.

44[NH] misMatch

Expand Messages
  • Grant
    Jun 30, 1999
    • 0 Attachment
      In apology for the error of my misMatching post here's a simple mismatch
      error checker for *.js and *.css files. Checks for misMatching curly braces,
      comment blocks in js and css files and colon semicolon pair in css files and
      reports on any errors. I've called the clip misMatch so you can test it out
      however you could place it an onClose clip so it remains unobtrusive unless
      required.


      H="misMatch"
      ;simpleMatchChecker
      ^!Set %msg%=^%empty%
      ^!IfSAME "^$GetExt(^$GetDocName$)$" ".css" NEXT ELSE SKIP
      ^!IfDiff ^$StrCount(":";"^$GetText$";True;False)$
      ^$StrCount(";";"^$GetText$";True;False)$ msg1 Else Next
      ^!IfSAME "^$GetExt(^$GetDocName$)$" ".js" NEXT ELSE EXIT
      :matchCurlies
      ^!IfDiff ^$StrCount("{";"^$GetText$";True;False)$
      ^$StrCount("}";"^$GetText$";True;False)$ msg2 Else Next
      :matchComment
      ^!IfDiff ^$StrCount("/*";"^$GetText$";True;False)$
      ^$StrCount("*/";"^$GetText$";True;False)$ msg3 Else Next
      :CreateReport
      ^!Info ^%msg%
      ^!GOTO EXIT
      :msg1
      ^!Set %msg%=colon (:) count = ^$StrCount(":";"^$GetText$";True;False)$^%NL%
      ^!Set %msg%=^%msg%semicolon (;)
      count^$StrCount(";";"^$GetText$";True;False)$^%NL%
      ^!Set %msg%=^%msg%Declarations for each selector ought to contain a colon
      (:) and end with a semicolon (;)
      ^!Set %msg%=^%msg% exept for the last declaration which does not need to end
      with a semicolon (;).
      ^!Set %msg%=^%msg%However it is a good practice to grt in the habit of
      ending all css declarations with a semicolon (;)
      ^!Set %msg%=^%msg%^%NL%
      ^!Goto matchCurlies
      :msg2
      ^!Set %msg%=^%msg%left curly brace ({) count =
      ^$StrCount("{";"^$GetText$";True;False)$^%NL%
      ^!Set %msg%=^%msg%right curly brace ({) count =
      ^$StrCount("}";"^$GetText$";True;False)$^%NL%
      ^!Set %msg%=^%msg%Braces ({ }) must always occur in matching pairs
      ^!Set %msg%=^%msg%^%NL%
      ^!Goto matchComment
      :msg3
      ^!Set %msg%=^%msg%Comment start characters "/*" count =
      ^$StrCount("/*";"^$GetText$";True;False)$^%NL%
      ^!Set %msg%=^%msg%Comment end characters "*/" count =
      ^$StrCount("*/";"^$GetText$";True;False)$^%NL%
      ^!Set %msg%=^%msg%Comment block characters (/* */) must always occur in
      matching pairs
      ^!Set %msg%=^%msg%^%NL%
      ^!Goto CreateReport


      ------------------------------------------------------------------------

      eGroups.com home: http://www.egroups.com/group/ntb-html
      http://www.egroups.com - Simplifying group communications
    • Show all 7 messages in this topic