2 Copyright (C) 2004 eXtrapola Srl
4 This file is part of SOPE.
6 SOPE is free software; you can redistribute it and/or modify it under
7 the terms of the GNU Lesser General Public License as published by the
8 Free Software Foundation; either version 2, or (at your option) any
11 SOPE is distributed in the hope that it will be useful, but WITHOUT ANY
12 WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
14 License for more details.
16 You should have received a copy of the GNU Lesser General Public
17 License along with SOPE; see the file COPYING. If not, write to the
18 Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
22 #ifndef __StructuredText_H__
23 #define __StructuredText_H__
25 #import <Foundation/NSObject.h>
26 #include "StructuredTextDocument.h"
28 @class NSString, NSMutableString;
29 @class StructuredLine, StructuredStack;
30 @class StructuredTextHeader, StructuredTextParagraph, StructuredTextList;
31 @class StructuredTextListItem, StructuredTextLiteralBlock;
33 #define StructuredTextParserLine_Header 0
34 #define StructuredTextParserLine_Paragraph 1
35 #define StructuredTextParserLine_List 2
36 #define StructuredTextParserLine_LiteralBlock 3
38 @interface StructuredText : NSObject
41 StructuredTextDocument *_document;
42 StructuredStack *_stack;
44 StructuredStack *_paragraphs;
47 int currentHeaderLevel;
51 + (StructuredTextDocument *)parseText:(NSString *)_txt;
52 - (id)initWithString:(NSString *)_str;
57 - (StructuredTextDocument *)document;
58 - (StructuredStack *)stack;
59 - (StructuredStack *)paragraphs;
65 - (int)lineType:(StructuredLine *)_line;
67 - (void)separateIntoBlocks;
68 - (void)adjustLineLevels;
69 - (void)buildDocument;
71 - (BOOL)checkForHeader:(StructuredLine *)_line;
72 - (BOOL)checkForListItem:(StructuredLine *)_line;
73 - (BOOL)checkForPreformattedStatement:(StructuredLine *)_line;
74 - (BOOL)checkForPreformattedBlock:(StructuredLine *)_line;
76 - (StructuredTextHeader *)buildHeader;
77 - (StructuredTextParagraph *)buildParagraph;
78 - (StructuredTextLiteralBlock *)buildLiteralBlock;
79 - (StructuredTextList *)buildList;
81 - (int)listItemTypology:(StructuredLine *)_line;
85 #endif /* __StructuredText_H__ */