*require_once 'Text/Highlighter/Generator.php'; *$generator =& new Text_Highlighter_Generator('php.xml'); *$generator->generate(); *$generator->saveCode('PHP.php'); *
language} syntax highlighting CODE; if ($this->_comment) { $comment = preg_replace('~^~m',' * ',$this->_comment); $this->_code .= "\n * \n" . $comment; } $this->_code .= <<_syntaxFile CODE; foreach ($this->_authors as $author) { $this->_code .= ' * @author ' . $author['name']; if ($author['email']) { $this->_code .= ' <' . $author['email'] . '>'; } $this->_code .= "\n"; } $this->_code .= <<language} syntax highlighting * CODE; foreach ($this->_authors as $author) { $this->_code .= ' * @author ' . $author['name']; if ($author['email']) { $this->_code .= ' <' . $author['email']. '>'; } $this->_code .= "\n"; } $this->_code .= <<language} extends Text_Highlighter { CODE; $this->_code .= 'var $_language = \'' . strtolower($this->language) . "';\n\n"; $array = var_export($syntax, true); $array = trim(preg_replace('~^(\s*)~m',' \1\1',$array)); // \$this->_syntax = $array; $this->_code .= <<_code .= <<_options = \$options; CODE; $states = array(); $i = 0; foreach ($syntax['blocks'] as $name => $block) { if ($block['type'] == 'region') { $states[$name] = $i++; } } $regs = array(); $counts = array(); $delim = array(); $inner = array(); $end = array(); $stat = array(); $keywords = array(); $parts = array(); $kwmap = array(); $subst = array(); $re = array(); $ce = array(); $rd = array(); $in = array(); $st = array(); $kw = array(); $sb = array(); foreach ($syntax['toplevel'] as $name) { $block = $syntax['blocks'][$name]; if ($block['type'] == 'block') { $kwm = array(); $re[] = '(' . $block['match'] . ')'; $ce[] = $this->_countSubpatterns($block['match']); $rd[] = ''; $sb[] = false;; $st[] = -1; foreach ($syntax['keywords'] as $kwname => $kwgroup) { if ($kwgroup['inherits'] != $name) { continue; } $gre = implode('|', array_keys($kwgroup['match'])); if (!$kwgroup['case']) { $gre = '(?i)' . $gre; } $kwm[$kwname][] = $gre; $kwmap[$kwname] = $kwgroup['innerGroup']; } foreach ($kwm as $g => $ma) { $kwm[$g] = '/^(' . implode(')|(', $ma) . ')$/'; } $kw[] = $kwm; } else { $kw[] = -1; $re[] = '(' . $block['start'] . ')'; $ce[] = $this->_countSubpatterns($block['start']); $rd[] = $block['delimGroup']; $st[] = $states[$name]; $sb[] = $block['remember']; } $in[] = $block['innerGroup']; } $re = implode('|', $re); $regs[-1] = '/' . $re . '/'; $counts[-1] = $ce; $delim[-1] = $rd; $inner[-1] = $in; $stat[-1] = $st; $keywords[-1] = $kw; $subst[-1] = $sb; foreach ($syntax['blocks'] as $ablock) { if ($ablock['type'] != 'region') { continue; } $end[] = '/' . $ablock['end'] . '/'; $re = array(); $ce = array(); $rd = array(); $in = array(); $st = array(); $kw = array(); $pc = array(); $sb = array(); foreach ((array)@$ablock['lookfor'] as $name) { $block = $syntax['blocks'][$name]; if (isset($block['partClass'])) { $pc[] = $block['partClass']; } else { $pc[] = null; } if ($block['type'] == 'block') { $kwm = array();; $re[] = '(' . $block['match'] . ')'; $ce[] = $this->_countSubpatterns($block['match']); $rd[] = ''; $sb[] = false; $st[] = -1; foreach ($syntax['keywords'] as $kwname => $kwgroup) { if ($kwgroup['inherits'] != $name) { continue; } $gre = implode('|', array_keys($kwgroup['match'])); if (!$kwgroup['case']) { $gre = '(?i)' . $gre; } $kwm[$kwname][] = $gre; $kwmap[$kwname] = $kwgroup['innerGroup']; } foreach ($kwm as $g => $ma) { $kwm[$g] = '/^(' . implode(')|(', $ma) . ')$/'; } $kw[] = $kwm; } else { $sb[] = $block['remember']; $kw[] = -1; $re[] = '(' . $block['start'] . ')'; $ce[] = $this->_countSubpatterns($block['start']); $rd[] = $block['delimGroup']; $st[] = $states[$name]; } $in[] = $block['innerGroup']; } $re = implode('|', $re); $regs[] = '/' . $re . '/'; $counts[] = $ce; $delim[] = $rd; $inner[] = $in; $stat[] = $st; $keywords[] = $kw; $parts[] = $pc; $subst[] = $sb; } $this->_code .= "\n \$this->_regs = " . $this->_exportArray($regs); $this->_code .= ";\n \$this->_counts = " .$this->_exportArray($counts); $this->_code .= ";\n \$this->_delim = " .$this->_exportArray($delim); $this->_code .= ";\n \$this->_inner = " .$this->_exportArray($inner); $this->_code .= ";\n \$this->_end = " .$this->_exportArray($end); $this->_code .= ";\n \$this->_states = " .$this->_exportArray($stat); $this->_code .= ";\n \$this->_keywords = " .$this->_exportArray($keywords); $this->_code .= ";\n \$this->_parts = " .$this->_exportArray($parts); $this->_code .= ";\n \$this->_subst = " .$this->_exportArray($subst); $this->_code .= ";\n \$this->_conditions = " .$this->_exportArray($conditions); $this->_code .= ";\n \$this->_kwmap = " .$this->_exportArray($kwmap); $this->_code .= ";\n \$this->_defClass = '" .$this->_defClass . '\''; $this->_code .= <<_checkDefines(); } } CODE; } // }}} } /* * Local variables: * tab-width: 4 * c-basic-offset: 4 * c-hanging-comment-ender-p: nil * End: */ ?>
_syntaxFile CODE; foreach ($this->_authors as $author) { $this->_code .= ' * @author ' . $author['name']; if ($author['email']) { $this->_code .= ' <' . $author['email'] . '>'; } $this->_code .= "\n"; } $this->_code .= <<language} syntax highlighting * CODE; foreach ($this->_authors as $author) { $this->_code .= ' * @author ' . $author['name']; if ($author['email']) { $this->_code .= ' <' . $author['email']. '>'; } $this->_code .= "\n"; } $this->_code .= <<language} extends Text_Highlighter { CODE; $this->_code .= 'var $_language = \'' . strtolower($this->language) . "';\n\n"; $array = var_export($syntax, true); $array = trim(preg_replace('~^(\s*)~m',' \1\1',$array)); // \$this->_syntax = $array; $this->_code .= <<_code .= <<_options = \$options; CODE; $states = array(); $i = 0; foreach ($syntax['blocks'] as $name => $block) { if ($block['type'] == 'region') { $states[$name] = $i++; } } $regs = array(); $counts = array(); $delim = array(); $inner = array(); $end = array(); $stat = array(); $keywords = array(); $parts = array(); $kwmap = array(); $subst = array(); $re = array(); $ce = array(); $rd = array(); $in = array(); $st = array(); $kw = array(); $sb = array(); foreach ($syntax['toplevel'] as $name) { $block = $syntax['blocks'][$name]; if ($block['type'] == 'block') { $kwm = array(); $re[] = '(' . $block['match'] . ')'; $ce[] = $this->_countSubpatterns($block['match']); $rd[] = ''; $sb[] = false;; $st[] = -1; foreach ($syntax['keywords'] as $kwname => $kwgroup) { if ($kwgroup['inherits'] != $name) { continue; } $gre = implode('|', array_keys($kwgroup['match'])); if (!$kwgroup['case']) { $gre = '(?i)' . $gre; } $kwm[$kwname][] = $gre; $kwmap[$kwname] = $kwgroup['innerGroup']; } foreach ($kwm as $g => $ma) { $kwm[$g] = '/^(' . implode(')|(', $ma) . ')$/'; } $kw[] = $kwm; } else { $kw[] = -1; $re[] = '(' . $block['start'] . ')'; $ce[] = $this->_countSubpatterns($block['start']); $rd[] = $block['delimGroup']; $st[] = $states[$name]; $sb[] = $block['remember']; } $in[] = $block['innerGroup']; } $re = implode('|', $re); $regs[-1] = '/' . $re . '/'; $counts[-1] = $ce; $delim[-1] = $rd; $inner[-1] = $in; $stat[-1] = $st; $keywords[-1] = $kw; $subst[-1] = $sb; foreach ($syntax['blocks'] as $ablock) { if ($ablock['type'] != 'region') { continue; } $end[] = '/' . $ablock['end'] . '/'; $re = array(); $ce = array(); $rd = array(); $in = array(); $st = array(); $kw = array(); $pc = array(); $sb = array(); foreach ((array)@$ablock['lookfor'] as $name) { $block = $syntax['blocks'][$name]; if (isset($block['partClass'])) { $pc[] = $block['partClass']; } else { $pc[] = null; } if ($block['type'] == 'block') { $kwm = array();; $re[] = '(' . $block['match'] . ')'; $ce[] = $this->_countSubpatterns($block['match']); $rd[] = ''; $sb[] = false; $st[] = -1; foreach ($syntax['keywords'] as $kwname => $kwgroup) { if ($kwgroup['inherits'] != $name) { continue; } $gre = implode('|', array_keys($kwgroup['match'])); if (!$kwgroup['case']) { $gre = '(?i)' . $gre; } $kwm[$kwname][] = $gre; $kwmap[$kwname] = $kwgroup['innerGroup']; } foreach ($kwm as $g => $ma) { $kwm[$g] = '/^(' . implode(')|(', $ma) . ')$/'; } $kw[] = $kwm; } else { $sb[] = $block['remember']; $kw[] = -1; $re[] = '(' . $block['start'] . ')'; $ce[] = $this->_countSubpatterns($block['start']); $rd[] = $block['delimGroup']; $st[] = $states[$name]; } $in[] = $block['innerGroup']; } $re = implode('|', $re); $regs[] = '/' . $re . '/'; $counts[] = $ce; $delim[] = $rd; $inner[] = $in; $stat[] = $st; $keywords[] = $kw; $parts[] = $pc; $subst[] = $sb; } $this->_code .= "\n \$this->_regs = " . $this->_exportArray($regs); $this->_code .= ";\n \$this->_counts = " .$this->_exportArray($counts); $this->_code .= ";\n \$this->_delim = " .$this->_exportArray($delim); $this->_code .= ";\n \$this->_inner = " .$this->_exportArray($inner); $this->_code .= ";\n \$this->_end = " .$this->_exportArray($end); $this->_code .= ";\n \$this->_states = " .$this->_exportArray($stat); $this->_code .= ";\n \$this->_keywords = " .$this->_exportArray($keywords); $this->_code .= ";\n \$this->_parts = " .$this->_exportArray($parts); $this->_code .= ";\n \$this->_subst = " .$this->_exportArray($subst); $this->_code .= ";\n \$this->_conditions = " .$this->_exportArray($conditions); $this->_code .= ";\n \$this->_kwmap = " .$this->_exportArray($kwmap); $this->_code .= ";\n \$this->_defClass = '" .$this->_defClass . '\''; $this->_code .= <<_checkDefines(); } } CODE; } // }}} } /* * Local variables: * tab-width: 4 * c-basic-offset: 4 * c-hanging-comment-ender-p: nil * End: */ ?>
language} syntax highlighting * CODE; foreach ($this->_authors as $author) { $this->_code .= ' * @author ' . $author['name']; if ($author['email']) { $this->_code .= ' <' . $author['email']. '>'; } $this->_code .= "\n"; } $this->_code .= <<language} extends Text_Highlighter { CODE; $this->_code .= 'var $_language = \'' . strtolower($this->language) . "';\n\n"; $array = var_export($syntax, true); $array = trim(preg_replace('~^(\s*)~m',' \1\1',$array)); // \$this->_syntax = $array; $this->_code .= <<_code .= <<_options = \$options; CODE; $states = array(); $i = 0; foreach ($syntax['blocks'] as $name => $block) { if ($block['type'] == 'region') { $states[$name] = $i++; } } $regs = array(); $counts = array(); $delim = array(); $inner = array(); $end = array(); $stat = array(); $keywords = array(); $parts = array(); $kwmap = array(); $subst = array(); $re = array(); $ce = array(); $rd = array(); $in = array(); $st = array(); $kw = array(); $sb = array(); foreach ($syntax['toplevel'] as $name) { $block = $syntax['blocks'][$name]; if ($block['type'] == 'block') { $kwm = array(); $re[] = '(' . $block['match'] . ')'; $ce[] = $this->_countSubpatterns($block['match']); $rd[] = ''; $sb[] = false;; $st[] = -1; foreach ($syntax['keywords'] as $kwname => $kwgroup) { if ($kwgroup['inherits'] != $name) { continue; } $gre = implode('|', array_keys($kwgroup['match'])); if (!$kwgroup['case']) { $gre = '(?i)' . $gre; } $kwm[$kwname][] = $gre; $kwmap[$kwname] = $kwgroup['innerGroup']; } foreach ($kwm as $g => $ma) { $kwm[$g] = '/^(' . implode(')|(', $ma) . ')$/'; } $kw[] = $kwm; } else { $kw[] = -1; $re[] = '(' . $block['start'] . ')'; $ce[] = $this->_countSubpatterns($block['start']); $rd[] = $block['delimGroup']; $st[] = $states[$name]; $sb[] = $block['remember']; } $in[] = $block['innerGroup']; } $re = implode('|', $re); $regs[-1] = '/' . $re . '/'; $counts[-1] = $ce; $delim[-1] = $rd; $inner[-1] = $in; $stat[-1] = $st; $keywords[-1] = $kw; $subst[-1] = $sb; foreach ($syntax['blocks'] as $ablock) { if ($ablock['type'] != 'region') { continue; } $end[] = '/' . $ablock['end'] . '/'; $re = array(); $ce = array(); $rd = array(); $in = array(); $st = array(); $kw = array(); $pc = array(); $sb = array(); foreach ((array)@$ablock['lookfor'] as $name) { $block = $syntax['blocks'][$name]; if (isset($block['partClass'])) { $pc[] = $block['partClass']; } else { $pc[] = null; } if ($block['type'] == 'block') { $kwm = array();; $re[] = '(' . $block['match'] . ')'; $ce[] = $this->_countSubpatterns($block['match']); $rd[] = ''; $sb[] = false; $st[] = -1; foreach ($syntax['keywords'] as $kwname => $kwgroup) { if ($kwgroup['inherits'] != $name) { continue; } $gre = implode('|', array_keys($kwgroup['match'])); if (!$kwgroup['case']) { $gre = '(?i)' . $gre; } $kwm[$kwname][] = $gre; $kwmap[$kwname] = $kwgroup['innerGroup']; } foreach ($kwm as $g => $ma) { $kwm[$g] = '/^(' . implode(')|(', $ma) . ')$/'; } $kw[] = $kwm; } else { $sb[] = $block['remember']; $kw[] = -1; $re[] = '(' . $block['start'] . ')'; $ce[] = $this->_countSubpatterns($block['start']); $rd[] = $block['delimGroup']; $st[] = $states[$name]; } $in[] = $block['innerGroup']; } $re = implode('|', $re); $regs[] = '/' . $re . '/'; $counts[] = $ce; $delim[] = $rd; $inner[] = $in; $stat[] = $st; $keywords[] = $kw; $parts[] = $pc; $subst[] = $sb; } $this->_code .= "\n \$this->_regs = " . $this->_exportArray($regs); $this->_code .= ";\n \$this->_counts = " .$this->_exportArray($counts); $this->_code .= ";\n \$this->_delim = " .$this->_exportArray($delim); $this->_code .= ";\n \$this->_inner = " .$this->_exportArray($inner); $this->_code .= ";\n \$this->_end = " .$this->_exportArray($end); $this->_code .= ";\n \$this->_states = " .$this->_exportArray($stat); $this->_code .= ";\n \$this->_keywords = " .$this->_exportArray($keywords); $this->_code .= ";\n \$this->_parts = " .$this->_exportArray($parts); $this->_code .= ";\n \$this->_subst = " .$this->_exportArray($subst); $this->_code .= ";\n \$this->_conditions = " .$this->_exportArray($conditions); $this->_code .= ";\n \$this->_kwmap = " .$this->_exportArray($kwmap); $this->_code .= ";\n \$this->_defClass = '" .$this->_defClass . '\''; $this->_code .= <<_checkDefines(); } } CODE; } // }}} } /* * Local variables: * tab-width: 4 * c-basic-offset: 4 * c-hanging-comment-ender-p: nil * End: */ ?>
language} extends Text_Highlighter { CODE; $this->_code .= 'var $_language = \'' . strtolower($this->language) . "';\n\n"; $array = var_export($syntax, true); $array = trim(preg_replace('~^(\s*)~m',' \1\1',$array)); // \$this->_syntax = $array; $this->_code .= <<_code .= <<_options = \$options; CODE; $states = array(); $i = 0; foreach ($syntax['blocks'] as $name => $block) { if ($block['type'] == 'region') { $states[$name] = $i++; } } $regs = array(); $counts = array(); $delim = array(); $inner = array(); $end = array(); $stat = array(); $keywords = array(); $parts = array(); $kwmap = array(); $subst = array(); $re = array(); $ce = array(); $rd = array(); $in = array(); $st = array(); $kw = array(); $sb = array(); foreach ($syntax['toplevel'] as $name) { $block = $syntax['blocks'][$name]; if ($block['type'] == 'block') { $kwm = array(); $re[] = '(' . $block['match'] . ')'; $ce[] = $this->_countSubpatterns($block['match']); $rd[] = ''; $sb[] = false;; $st[] = -1; foreach ($syntax['keywords'] as $kwname => $kwgroup) { if ($kwgroup['inherits'] != $name) { continue; } $gre = implode('|', array_keys($kwgroup['match'])); if (!$kwgroup['case']) { $gre = '(?i)' . $gre; } $kwm[$kwname][] = $gre; $kwmap[$kwname] = $kwgroup['innerGroup']; } foreach ($kwm as $g => $ma) { $kwm[$g] = '/^(' . implode(')|(', $ma) . ')$/'; } $kw[] = $kwm; } else { $kw[] = -1; $re[] = '(' . $block['start'] . ')'; $ce[] = $this->_countSubpatterns($block['start']); $rd[] = $block['delimGroup']; $st[] = $states[$name]; $sb[] = $block['remember']; } $in[] = $block['innerGroup']; } $re = implode('|', $re); $regs[-1] = '/' . $re . '/'; $counts[-1] = $ce; $delim[-1] = $rd; $inner[-1] = $in; $stat[-1] = $st; $keywords[-1] = $kw; $subst[-1] = $sb; foreach ($syntax['blocks'] as $ablock) { if ($ablock['type'] != 'region') { continue; } $end[] = '/' . $ablock['end'] . '/'; $re = array(); $ce = array(); $rd = array(); $in = array(); $st = array(); $kw = array(); $pc = array(); $sb = array(); foreach ((array)@$ablock['lookfor'] as $name) { $block = $syntax['blocks'][$name]; if (isset($block['partClass'])) { $pc[] = $block['partClass']; } else { $pc[] = null; } if ($block['type'] == 'block') { $kwm = array();; $re[] = '(' . $block['match'] . ')'; $ce[] = $this->_countSubpatterns($block['match']); $rd[] = ''; $sb[] = false; $st[] = -1; foreach ($syntax['keywords'] as $kwname => $kwgroup) { if ($kwgroup['inherits'] != $name) { continue; } $gre = implode('|', array_keys($kwgroup['match'])); if (!$kwgroup['case']) { $gre = '(?i)' . $gre; } $kwm[$kwname][] = $gre; $kwmap[$kwname] = $kwgroup['innerGroup']; } foreach ($kwm as $g => $ma) { $kwm[$g] = '/^(' . implode(')|(', $ma) . ')$/'; } $kw[] = $kwm; } else { $sb[] = $block['remember']; $kw[] = -1; $re[] = '(' . $block['start'] . ')'; $ce[] = $this->_countSubpatterns($block['start']); $rd[] = $block['delimGroup']; $st[] = $states[$name]; } $in[] = $block['innerGroup']; } $re = implode('|', $re); $regs[] = '/' . $re . '/'; $counts[] = $ce; $delim[] = $rd; $inner[] = $in; $stat[] = $st; $keywords[] = $kw; $parts[] = $pc; $subst[] = $sb; } $this->_code .= "\n \$this->_regs = " . $this->_exportArray($regs); $this->_code .= ";\n \$this->_counts = " .$this->_exportArray($counts); $this->_code .= ";\n \$this->_delim = " .$this->_exportArray($delim); $this->_code .= ";\n \$this->_inner = " .$this->_exportArray($inner); $this->_code .= ";\n \$this->_end = " .$this->_exportArray($end); $this->_code .= ";\n \$this->_states = " .$this->_exportArray($stat); $this->_code .= ";\n \$this->_keywords = " .$this->_exportArray($keywords); $this->_code .= ";\n \$this->_parts = " .$this->_exportArray($parts); $this->_code .= ";\n \$this->_subst = " .$this->_exportArray($subst); $this->_code .= ";\n \$this->_conditions = " .$this->_exportArray($conditions); $this->_code .= ";\n \$this->_kwmap = " .$this->_exportArray($kwmap); $this->_code .= ";\n \$this->_defClass = '" .$this->_defClass . '\''; $this->_code .= <<_checkDefines(); } } CODE; } // }}} } /* * Local variables: * tab-width: 4 * c-basic-offset: 4 * c-hanging-comment-ender-p: nil * End: */ ?>
_code .= <<_options = \$options; CODE; $states = array(); $i = 0; foreach ($syntax['blocks'] as $name => $block) { if ($block['type'] == 'region') { $states[$name] = $i++; } } $regs = array(); $counts = array(); $delim = array(); $inner = array(); $end = array(); $stat = array(); $keywords = array(); $parts = array(); $kwmap = array(); $subst = array(); $re = array(); $ce = array(); $rd = array(); $in = array(); $st = array(); $kw = array(); $sb = array(); foreach ($syntax['toplevel'] as $name) { $block = $syntax['blocks'][$name]; if ($block['type'] == 'block') { $kwm = array(); $re[] = '(' . $block['match'] . ')'; $ce[] = $this->_countSubpatterns($block['match']); $rd[] = ''; $sb[] = false;; $st[] = -1; foreach ($syntax['keywords'] as $kwname => $kwgroup) { if ($kwgroup['inherits'] != $name) { continue; } $gre = implode('|', array_keys($kwgroup['match'])); if (!$kwgroup['case']) { $gre = '(?i)' . $gre; } $kwm[$kwname][] = $gre; $kwmap[$kwname] = $kwgroup['innerGroup']; } foreach ($kwm as $g => $ma) { $kwm[$g] = '/^(' . implode(')|(', $ma) . ')$/'; } $kw[] = $kwm; } else { $kw[] = -1; $re[] = '(' . $block['start'] . ')'; $ce[] = $this->_countSubpatterns($block['start']); $rd[] = $block['delimGroup']; $st[] = $states[$name]; $sb[] = $block['remember']; } $in[] = $block['innerGroup']; } $re = implode('|', $re); $regs[-1] = '/' . $re . '/'; $counts[-1] = $ce; $delim[-1] = $rd; $inner[-1] = $in; $stat[-1] = $st; $keywords[-1] = $kw; $subst[-1] = $sb; foreach ($syntax['blocks'] as $ablock) { if ($ablock['type'] != 'region') { continue; } $end[] = '/' . $ablock['end'] . '/'; $re = array(); $ce = array(); $rd = array(); $in = array(); $st = array(); $kw = array(); $pc = array(); $sb = array(); foreach ((array)@$ablock['lookfor'] as $name) { $block = $syntax['blocks'][$name]; if (isset($block['partClass'])) { $pc[] = $block['partClass']; } else { $pc[] = null; } if ($block['type'] == 'block') { $kwm = array();; $re[] = '(' . $block['match'] . ')'; $ce[] = $this->_countSubpatterns($block['match']); $rd[] = ''; $sb[] = false; $st[] = -1; foreach ($syntax['keywords'] as $kwname => $kwgroup) { if ($kwgroup['inherits'] != $name) { continue; } $gre = implode('|', array_keys($kwgroup['match'])); if (!$kwgroup['case']) { $gre = '(?i)' . $gre; } $kwm[$kwname][] = $gre; $kwmap[$kwname] = $kwgroup['innerGroup']; } foreach ($kwm as $g => $ma) { $kwm[$g] = '/^(' . implode(')|(', $ma) . ')$/'; } $kw[] = $kwm; } else { $sb[] = $block['remember']; $kw[] = -1; $re[] = '(' . $block['start'] . ')'; $ce[] = $this->_countSubpatterns($block['start']); $rd[] = $block['delimGroup']; $st[] = $states[$name]; } $in[] = $block['innerGroup']; } $re = implode('|', $re); $regs[] = '/' . $re . '/'; $counts[] = $ce; $delim[] = $rd; $inner[] = $in; $stat[] = $st; $keywords[] = $kw; $parts[] = $pc; $subst[] = $sb; } $this->_code .= "\n \$this->_regs = " . $this->_exportArray($regs); $this->_code .= ";\n \$this->_counts = " .$this->_exportArray($counts); $this->_code .= ";\n \$this->_delim = " .$this->_exportArray($delim); $this->_code .= ";\n \$this->_inner = " .$this->_exportArray($inner); $this->_code .= ";\n \$this->_end = " .$this->_exportArray($end); $this->_code .= ";\n \$this->_states = " .$this->_exportArray($stat); $this->_code .= ";\n \$this->_keywords = " .$this->_exportArray($keywords); $this->_code .= ";\n \$this->_parts = " .$this->_exportArray($parts); $this->_code .= ";\n \$this->_subst = " .$this->_exportArray($subst); $this->_code .= ";\n \$this->_conditions = " .$this->_exportArray($conditions); $this->_code .= ";\n \$this->_kwmap = " .$this->_exportArray($kwmap); $this->_code .= ";\n \$this->_defClass = '" .$this->_defClass . '\''; $this->_code .= <<_checkDefines(); } } CODE; } // }}} } /* * Local variables: * tab-width: 4 * c-basic-offset: 4 * c-hanging-comment-ender-p: nil * End: */ ?>
_options = \$options; CODE; $states = array(); $i = 0; foreach ($syntax['blocks'] as $name => $block) { if ($block['type'] == 'region') { $states[$name] = $i++; } } $regs = array(); $counts = array(); $delim = array(); $inner = array(); $end = array(); $stat = array(); $keywords = array(); $parts = array(); $kwmap = array(); $subst = array(); $re = array(); $ce = array(); $rd = array(); $in = array(); $st = array(); $kw = array(); $sb = array(); foreach ($syntax['toplevel'] as $name) { $block = $syntax['blocks'][$name]; if ($block['type'] == 'block') { $kwm = array(); $re[] = '(' . $block['match'] . ')'; $ce[] = $this->_countSubpatterns($block['match']); $rd[] = ''; $sb[] = false;; $st[] = -1; foreach ($syntax['keywords'] as $kwname => $kwgroup) { if ($kwgroup['inherits'] != $name) { continue; } $gre = implode('|', array_keys($kwgroup['match'])); if (!$kwgroup['case']) { $gre = '(?i)' . $gre; } $kwm[$kwname][] = $gre; $kwmap[$kwname] = $kwgroup['innerGroup']; } foreach ($kwm as $g => $ma) { $kwm[$g] = '/^(' . implode(')|(', $ma) . ')$/'; } $kw[] = $kwm; } else { $kw[] = -1; $re[] = '(' . $block['start'] . ')'; $ce[] = $this->_countSubpatterns($block['start']); $rd[] = $block['delimGroup']; $st[] = $states[$name]; $sb[] = $block['remember']; } $in[] = $block['innerGroup']; } $re = implode('|', $re); $regs[-1] = '/' . $re . '/'; $counts[-1] = $ce; $delim[-1] = $rd; $inner[-1] = $in; $stat[-1] = $st; $keywords[-1] = $kw; $subst[-1] = $sb; foreach ($syntax['blocks'] as $ablock) { if ($ablock['type'] != 'region') { continue; } $end[] = '/' . $ablock['end'] . '/'; $re = array(); $ce = array(); $rd = array(); $in = array(); $st = array(); $kw = array(); $pc = array(); $sb = array(); foreach ((array)@$ablock['lookfor'] as $name) { $block = $syntax['blocks'][$name]; if (isset($block['partClass'])) { $pc[] = $block['partClass']; } else { $pc[] = null; } if ($block['type'] == 'block') { $kwm = array();; $re[] = '(' . $block['match'] . ')'; $ce[] = $this->_countSubpatterns($block['match']); $rd[] = ''; $sb[] = false; $st[] = -1; foreach ($syntax['keywords'] as $kwname => $kwgroup) { if ($kwgroup['inherits'] != $name) { continue; } $gre = implode('|', array_keys($kwgroup['match'])); if (!$kwgroup['case']) { $gre = '(?i)' . $gre; } $kwm[$kwname][] = $gre; $kwmap[$kwname] = $kwgroup['innerGroup']; } foreach ($kwm as $g => $ma) { $kwm[$g] = '/^(' . implode(')|(', $ma) . ')$/'; } $kw[] = $kwm; } else { $sb[] = $block['remember']; $kw[] = -1; $re[] = '(' . $block['start'] . ')'; $ce[] = $this->_countSubpatterns($block['start']); $rd[] = $block['delimGroup']; $st[] = $states[$name]; } $in[] = $block['innerGroup']; } $re = implode('|', $re); $regs[] = '/' . $re . '/'; $counts[] = $ce; $delim[] = $rd; $inner[] = $in; $stat[] = $st; $keywords[] = $kw; $parts[] = $pc; $subst[] = $sb; } $this->_code .= "\n \$this->_regs = " . $this->_exportArray($regs); $this->_code .= ";\n \$this->_counts = " .$this->_exportArray($counts); $this->_code .= ";\n \$this->_delim = " .$this->_exportArray($delim); $this->_code .= ";\n \$this->_inner = " .$this->_exportArray($inner); $this->_code .= ";\n \$this->_end = " .$this->_exportArray($end); $this->_code .= ";\n \$this->_states = " .$this->_exportArray($stat); $this->_code .= ";\n \$this->_keywords = " .$this->_exportArray($keywords); $this->_code .= ";\n \$this->_parts = " .$this->_exportArray($parts); $this->_code .= ";\n \$this->_subst = " .$this->_exportArray($subst); $this->_code .= ";\n \$this->_conditions = " .$this->_exportArray($conditions); $this->_code .= ";\n \$this->_kwmap = " .$this->_exportArray($kwmap); $this->_code .= ";\n \$this->_defClass = '" .$this->_defClass . '\''; $this->_code .= <<_checkDefines(); } } CODE; } // }}} } /* * Local variables: * tab-width: 4 * c-basic-offset: 4 * c-hanging-comment-ender-p: nil * End: */ ?>
_checkDefines(); } } CODE; } // }}} } /* * Local variables: * tab-width: 4 * c-basic-offset: 4 * c-hanging-comment-ender-p: nil * End: */ ?>