PEG Markdown Highlight
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Properties Defines
pmh_definitions.h
Go to the documentation of this file.
00001 /* PEG Markdown Highlight
00002  * Copyright 2011-2012 Ali Rantakari -- http://hasseg.org
00003  * Licensed under the GPL2+ and MIT licenses (see LICENSE for more info).
00004  * 
00005  * pmh_definitions.h
00006  */
00007 
00008 #ifndef pmh_MARKDOWN_DEFINITIONS
00009 #define pmh_MARKDOWN_DEFINITIONS
00010 
00026 typedef enum
00027 {
00028     pmh_LINK,               
00029     pmh_AUTO_LINK_URL,      
00030     pmh_AUTO_LINK_EMAIL,    
00031     pmh_IMAGE,              
00032     pmh_CODE,               
00033     pmh_HTML,               
00034     pmh_HTML_ENTITY,        
00035     pmh_EMPH,               
00036     pmh_STRONG,             
00037     pmh_LIST_BULLET,        
00038     pmh_LIST_ENUMERATOR,    
00039     pmh_COMMENT,            
00041     // Code assumes that pmh_H1-6 are in order.
00042     pmh_H1,                 
00043     pmh_H2,                 
00044     pmh_H3,                 
00045     pmh_H4,                 
00046     pmh_H5,                 
00047     pmh_H6,                 
00049     pmh_BLOCKQUOTE,         
00050     pmh_VERBATIM,           
00051     pmh_HTMLBLOCK,          
00052     pmh_HRULE,              
00053     pmh_REFERENCE,          
00054     pmh_NOTE,               
00056     // Utility types used by the parser itself:
00057     
00058     // List of pmh_RAW element lists, each to be processed separately from
00059     // others (for each element in linked lists of this type, `children` points
00060     // to a linked list of pmh_RAW elements):
00061     pmh_RAW_LIST,   
00063     // Span marker for positions in original input to be post-processed
00064     // in a second parsing step:
00065     pmh_RAW,        
00067     // Additional text to be parsed along with spans in the original input
00068     // (these may be added to linked lists of pmh_RAW elements):
00069     pmh_EXTRA_TEXT, 
00071     // Separates linked lists of pmh_RAW elements into parts to be processed
00072     // separate from each other:
00073     pmh_SEPARATOR,  
00075     // Placeholder element used while parsing:
00076     pmh_NO_TYPE,    
00078     // Linked list of *all* elements created while parsing:
00079     pmh_ALL         
00080 } pmh_element_type;
00081 
00086 #define pmh_NUM_TYPES 30
00087 
00092 #define pmh_NUM_LANG_TYPES (pmh_NUM_TYPES - 6)
00093 
00094 
00098 struct pmh_Element
00099 {
00100     pmh_element_type type;    
00101     unsigned long pos;        
00104     unsigned long end;        
00106     struct pmh_Element *next; 
00107     char *label;              
00108     char *address;            
00109 };
00110 typedef struct pmh_Element pmh_element;
00111 
00115 enum pmh_extensions
00116 {
00117     pmh_EXT_NONE    = 0,        
00118     pmh_EXT_NOTES   = (1 << 0)  
00120 };
00121 
00122 #endif