[haiku-development] Sniffer rule trouble

  • From: Stephan Assmus <superstippi@xxxxxx>
  • To: haiku-development@xxxxxxxxxxxxx
  • Date: Sat, 08 Nov 2008 21:21:46 +0100

Hi all,

in MimeType.cpp, some example sniffer rules are given:

        Examples:
        - 1.0 ('ABCD')
          The file must start with the string "ABCD". The priority of the rule
          is 1.0 (maximal).
        - 0.8 [0:3] ('ABCD' | 'abcd')
          The file must contain the string "ABCD" or "abcd" starting somewhere
          in the first four bytes. The rule priority is 0.8.
        - 0.5 ([0:3] 'ABCD' | [0:3] 'abcd' | [13] 'EFGH')
          The file must contain the string "ABCD" or "abcd" starting somewhere
          in the first four bytes or the string "EFGH" at position 13. The rule
          priority is 0.5.
        - 0.8 [0:3] ('ABCD' & 0xff00ffff | 'abcd' & 0xffff00ff)
          The file must contain the string "A.CD" or "ab.d" (whereas "." is an
          arbitrary character) starting somewhere in the first four bytes. The
          rule priority is 0.8.

... what is wrong with this rule then:

0.9 ([0] '1BOF' & [0:32] "layer")
                  ^   Sniffer pattern error: expected CharacterString, 
found LeftBracket

Best regards,
-Stephan

Other related posts: