interpl

Experiments with intepreters in Prolog
git clone https://ccx.te2000.cz/git/interpl
Log | Files | Refs | README

common.pl (1164B)


      1 :- module('syntax/common',
      2 	[ blank_code/1
      3 	, blank//0
      4 	, number//1
      5 	]).
      6 :- reexport(library(dcg/basics), [blanks//0]).
      7 
      8 blank_code(0x20).       % SPACE
      9 blank_code(0x9).        % ASCII HT  '\t' (horizontal tab)
     10 blank_code(0xa).        % ASCII LF  '\n' (new line)
     11 blank_code(0xb).        % ASCII VT  '\v' (vertical tab)
     12 blank_code(0xc).        % ASCII FF  '\f' (form feed)
     13 blank_code(0xd).        % ASCII CR  '\r' (carriage ret)
     14 blank_code(0x85).       % NEL (next line)
     15 blank_code(0x2000).     % EN QUAD
     16 blank_code(0x2001).     % EM QUAD
     17 blank_code(0x2002).     % EN SPACE
     18 blank_code(0x2003).     % EM SPACE
     19 blank_code(0x2004).     % THREE-PER-EM SPACE
     20 blank_code(0x2005).     % FOUR-PER-EM SPACE
     21 blank_code(0x2006).     % SIX-PER-EM SPACE
     22 blank_code(0x2008).     % PUNCTUATION SPACE
     23 blank_code(0x2009).     % THIN SPACE
     24 blank_code(0x200a).     % HAIR SPACE
     25 blank_code(0x2028).     % LINE SEPARATOR
     26 blank_code(0x2029).     % PARAGRAPH SEPARATOR
     27 blank_code(0x205f).     % MEDIUM MATHEMATICAL SPACE
     28 blank_code(0x3000).     % IDEOGRAPHIC SPACE
     29 
     30 blank --> [C], { blank_code(C) }.
     31 
     32 number(Number) --> {when(nonvar(Number), number(Number))},  dcg_basics:number(Number).