Changeset 131 for branches/generator
- Timestamp:
- Dec 24, 2017, 3:54:08 PM (7 years ago)
- Location:
- branches/generator
- Files:
-
- 2 added
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/generator/Forms/UFormMain.lfm
r130 r131 29 29 Height = 28 30 30 Top = 5 31 Width = 1 2531 Width = 171 32 32 Align = alNone 33 33 AutoSize = True … … 42 42 Transparent = True 43 43 object ToolButton2: TToolButton 44 Left = 9644 Left = 142 45 45 Top = 0 46 46 Action = ABuildCompiler … … 55 55 Top = 0 56 56 Action = AProjectOpen 57 DropdownMenu = PopupMenuOpenRecent 58 Style = tbsButtonDrop 57 59 end 58 60 object ToolButton5: TToolButton 59 Left = 5961 Left = 76 60 62 Top = 0 61 63 Action = AProjectSave 62 64 end 63 65 object ToolButton6: TToolButton 64 Left = 8866 Left = 134 65 67 Height = 28 66 68 Top = 0 67 69 Style = tbsSeparator 70 end 71 object ToolButton1: TToolButton 72 Left = 105 73 Top = 0 74 Action = AGrammerSettings 68 75 end 69 76 end … … 124 131 Action = AProjectOpen 125 132 end 133 object MenuItemRecent: TMenuItem 134 Caption = 'Open recent' 135 end 126 136 object MenuItem10: TMenuItem 127 137 Action = AProjectSave … … 151 161 object MenuItem1: TMenuItem 152 162 Caption = 'View' 163 object MenuItemToolbar: TMenuItem 164 Action = AToolbarVisible 165 AutoCheck = True 166 end 153 167 end 154 168 end … … 175 189 OnExecute = AProjectOpenExecute 176 190 end 191 object AProjectOpenRecent: TAction 192 Caption = 'Open recent' 193 OnExecute = AProjectOpenRecentExecute 194 end 177 195 object AProjectSaveAs: TAction 178 196 Caption = 'Save as...' … … 181 199 OnExecute = AProjectSaveAsExecute 182 200 end 201 object AProjectSave: TAction 202 Caption = 'Save' 203 ImageIndex = 5 204 OnExecute = AProjectSaveExecute 205 end 206 object AProjectNew: TAction 207 Caption = 'New' 208 ImageIndex = 10 209 OnExecute = AProjectNewExecute 210 end 211 object AProjectClose: TAction 212 Caption = 'Close' 213 OnExecute = AProjectCloseExecute 214 end 215 object AGrammerSettings: TAction 216 Caption = 'Settings' 217 ImageIndex = 3 218 OnExecute = AGrammerSettingsExecute 219 end 183 220 object ABuildCompiler: TAction 184 221 Caption = 'Build compiler' … … 186 223 OnExecute = ABuildCompilerExecute 187 224 end 188 object AProjectSave: TAction 189 Caption = 'Save' 190 ImageIndex = 5 191 OnExecute = AProjectSaveExecute 192 end 193 object AProjectNew: TAction 194 Caption = 'New' 195 ImageIndex = 10 196 OnExecute = AProjectNewExecute 197 end 198 object AGrammerSettings: TAction 199 Caption = 'Settings' 200 OnExecute = AGrammerSettingsExecute 201 end 202 object AProjectClose: TAction 203 Caption = 'Close' 204 OnExecute = AProjectCloseExecute 225 object AToolbarVisible: TAction 226 AutoCheck = True 227 Caption = 'Toolbar' 228 OnExecute = AToolbarVisibleExecute 205 229 end 206 230 end … … 217 241 top = 414 218 242 end 243 object LastOpenedList1: TLastOpenedList 244 MaxCount = 10 245 OnChange = LastOpenedList1Change 246 left = 155 247 top = 131 248 end 249 object PopupMenuOpenRecent: TPopupMenu 250 left = 149 251 top = 234 252 end 219 253 end -
branches/generator/Forms/UFormMain.pas
r130 r131 7 7 uses 8 8 Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, StdCtrls, 9 Menus, ActnList, ComCtrls, UPersistentForm, UGrammer; 9 Menus, ActnList, ComCtrls, UPersistentForm, ULastOpenedList, UGrammer, 10 XMLConf; 10 11 11 12 type … … 15 16 TFormMain = class(TForm) 16 17 ABuildCompiler: TAction; 18 AToolbarVisible: TAction; 19 AProjectOpenRecent: TAction; 17 20 AProjectClose: TAction; 18 21 AGrammerSettings: TAction; … … 25 28 ActionList1: TActionList; 26 29 CoolBar1: TCoolBar; 30 LastOpenedList1: TLastOpenedList; 27 31 MainMenu1: TMainMenu; 28 32 MemoEbnf: TMemo; … … 34 38 MenuItem13: TMenuItem; 35 39 MenuItem2: TMenuItem; 40 MenuItemRecent: TMenuItem; 41 MenuItemToolbar: TMenuItem; 36 42 MenuItem4: TMenuItem; 37 43 MenuItem5: TMenuItem; … … 42 48 OpenDialog1: TOpenDialog; 43 49 PageControl1: TPageControl; 50 PopupMenuOpenRecent: TPopupMenu; 44 51 SaveDialog1: TSaveDialog; 45 52 TabSheetRules: TTabSheet; … … 47 54 TabSheetEbnf: TTabSheet; 48 55 ToolBar1: TToolBar; 56 ToolButton1: TToolButton; 49 57 ToolButton2: TToolButton; 50 58 ToolButton3: TToolButton; … … 53 61 ToolButton6: TToolButton; 54 62 procedure ABuildCompilerExecute(Sender: TObject); 63 procedure AToolbarVisibleExecute(Sender: TObject); 55 64 procedure AExitExecute(Sender: TObject); 56 65 procedure AGrammerSettingsExecute(Sender: TObject); … … 58 67 procedure AProjectNewExecute(Sender: TObject); 59 68 procedure AProjectOpenExecute(Sender: TObject); 69 procedure AProjectOpenRecentExecute(Sender: TObject); 60 70 procedure AProjectCloseExecute(Sender: TObject); 61 71 procedure AProjectSaveAsExecute(Sender: TObject); … … 64 74 procedure FormCloseQuery(Sender: TObject; var CanClose: boolean); 65 75 procedure FormShow(Sender: TObject); 76 procedure LastOpenedList1Change(Sender: TObject); 66 77 private 67 procedure ReloadMemo;68 procedure UpdateInterface;69 78 procedure GrammerChange(Sender: TObject); 70 79 procedure GrammerDestroy(Sender: TObject); 71 80 public 72 { public declarations } 81 procedure ReloadMemo; 82 procedure UpdateInterface; 83 procedure ProjectOpen(FileName: string); 84 procedure ProjectNew; 85 procedure LoadConfig(XmlConfig: TXmlConfig); 86 procedure SaveConfig(XmlConfig: TXmlConfig); 73 87 end; 74 88 … … 108 122 SaveDialog1.FileName := ExtractFileName(Core.Grammer.FileName); 109 123 if SaveDialog1.Execute then begin 110 Core.LastOpenedFile := SaveDialog1.FileName;124 LastOpenedList1.AddItem(SaveDialog1.FileName); 111 125 Core.Grammer.SaveToXmlFile(SaveDialog1.FileName); 112 126 UpdateInterface; … … 123 137 begin 124 138 Core.PersistentForm1.Save(Self); 139 Core.Finalize; 125 140 end; 126 141 … … 145 160 end; 146 161 162 procedure TFormMain.LastOpenedList1Change(Sender: TObject); 163 begin 164 LastOpenedList1.LoadToMenuItem(MenuItemRecent, AProjectOpenRecentExecute); 165 LastOpenedList1.LoadToMenuItem(PopupMenuOpenRecent.Items, AProjectOpenRecentExecute); 166 end; 167 147 168 procedure TFormMain.ReloadMemo; 148 169 begin 149 170 if Assigned(Core.Grammer) then begin 150 MemoBnf.Lines.Text := Core.Grammer. GetString;151 MemoEbnf.Lines.Text := Core.Grammer. GetString;171 MemoBnf.Lines.Text := Core.Grammer.ExportAsString(gnBnf); 172 MemoEbnf.Lines.Text := Core.Grammer.ExportAsString(gnEbnf); 152 173 end else begin 153 174 MemoBnf.Lines.Clear; … … 172 193 ABuildCompiler.Enabled := Assigned(Core.Grammer); 173 194 ARules.Enabled := Assigned(Core.Grammer); 195 CoolBar1.Visible := AToolbarVisible.Checked; 174 196 end; 175 197 … … 194 216 FormRules.UpdateInterface; 195 217 end; 218 end; 219 220 procedure TFormMain.ProjectOpen(FileName: string); 221 begin 222 if Assigned(Core.Grammer) then FreeAndNil(Core.Grammer); 223 LastOpenedList1.AddItem(FileName); 224 Core.Grammer := TGrammer.Create; 225 Core.Grammer.OnChange := GrammerChange; 226 Core.Grammer.OnDestroy := GrammerDestroy; 227 Core.Grammer.LoadFromXmlFile(FileName); 228 Core.Grammer.Change; 229 end; 230 231 procedure TFormMain.ProjectNew; 232 begin 233 if Assigned(Core.Grammer) then FreeAndNil(Core.Grammer); 234 Core.Grammer := TGrammer.Create; 235 Core.Grammer.OnChange := GrammerChange; 236 Core.Grammer.OnDestroy := GrammerDestroy; 237 Core.Grammer.FileName := SNewGrammer; 238 Core.Grammer.Change; 239 end; 240 241 procedure TFormMain.LoadConfig(XmlConfig: TXmlConfig); 242 begin 243 AToolbarVisible.Checked := XmlConfig.GetValue('ToolbarVisible', True); 244 LastOpenedList1.LoadFromXMLConfig(XMLConfig, 'LastOpenedFiles'); 245 end; 246 247 procedure TFormMain.SaveConfig(XmlConfig: TXmlConfig); 248 begin 249 XmlConfig.SetValue('ToolbarVisible', AToolbarVisible.Checked); 250 LastOpenedList1.SaveToXMLConfig(XMLConfig, 'LastOpenedFiles'); 196 251 end; 197 252 … … 214 269 end; 215 270 271 procedure TFormMain.AProjectOpenRecentExecute(Sender: TObject); 272 begin 273 if Sender is TMenuItem then ProjectOpen(TMenuItem(Sender).Caption); 274 end; 275 216 276 procedure TFormMain.AProjectNewExecute(Sender: TObject); 217 277 begin 218 278 AProjectClose.Execute; 219 279 if not Assigned(Core.Grammer) then begin 220 Core.Grammer := TGrammer.Create; 221 Core.Grammer.FileName := SNewGrammer; 222 Core.Grammer.OnChange := GrammerChange; 223 Core.Grammer.OnDestroy := GrammerDestroy; 224 Core.Grammer.Change; 280 ProjectNew; 225 281 end; 226 282 end; … … 239 295 end; 240 296 297 procedure TFormMain.AToolbarVisibleExecute(Sender: TObject); 298 begin 299 UpdateInterface; 300 end; 301 241 302 procedure TFormMain.AProjectOpenExecute(Sender: TObject); 242 303 begin 243 304 AProjectClose.Execute; 244 305 if not Assigned(Core.Grammer) then begin 245 OpenDialog1.InitialDir := ExtractFileDir( Core.LastOpenedFile);246 OpenDialog1.FileName := ExtractFileName( Core.LastOpenedFile);306 OpenDialog1.InitialDir := ExtractFileDir(LastOpenedList1.GetFirstFileName); 307 OpenDialog1.FileName := ExtractFileName(LastOpenedList1.GetFirstFileName); 247 308 if OpenDialog1.Execute then begin 248 Core.LastOpenedFile := OpenDialog1.FileName; 249 Core.Grammer := TGrammer.Create; 250 Core.Grammer.OnChange := GrammerChange; 251 Core.Grammer.OnDestroy := GrammerDestroy; 252 Core.Grammer.LoadFromXmlFile(OpenDialog1.FileName); 253 Core.Grammer.Change; 309 ProjectOpen(OpenDialog1.FileName); 254 310 end; 255 311 end; -
branches/generator/Forms/UFormRule.lfm
r129 r131 8 8 ClientHeight = 514 9 9 ClientWidth = 663 10 DesignTimePPI = 12011 10 OnCreate = FormCreate 12 11 OnDestroy = FormDestroy 13 12 OnShow = FormShow 14 LCLVersion = '1.8.0. 6'13 LCLVersion = '1.8.0.4' 15 14 object ButtonOk: TButton 16 15 Left = 376 … … 35 34 object Label1: TLabel 36 35 Left = 16 37 Height = 2 036 Height = 23 38 37 Top = 16 39 Width = 4 338 Width = 49 40 39 Caption = 'Name:' 41 40 ParentColor = False … … 58 57 object TabSheetUsedBy: TTabSheet 59 58 Caption = 'Used by' 60 ClientHeight = 35 961 ClientWidth = 63 259 ClientHeight = 351 60 ClientWidth = 634 62 61 object ListView1: TListView 63 62 Left = 0 … … 69 68 item 70 69 Caption = 'Name' 71 Width = 20070 Width = 612 72 71 end> 73 72 OwnerData = True … … 82 81 object EditName: TEdit 83 82 Left = 135 84 Height = 2883 Height = 33 85 84 Top = 11 86 85 Width = 433 … … 89 88 object CheckBoxCreateNode: TCheckBox 90 89 Left = 16 91 Height = 2 490 Height = 27 92 91 Top = 48 93 Width = 1 5292 Width = 173 94 93 Caption = 'Create source node' 95 94 TabOrder = 4 … … 97 96 object Label2: TLabel 98 97 Left = 312 99 Height = 2 098 Height = 23 100 99 Top = 52 101 Width = 37102 Caption = 'L avel:'100 Width = 42 101 Caption = 'Level:' 103 102 ParentColor = False 104 103 end 105 104 object ComboBoxLevel: TComboBox 106 105 Left = 376 107 Height = 28106 Height = 37 108 107 Top = 48 109 108 Width = 125 110 ItemHeight = 20109 ItemHeight = 0 111 110 Style = csDropDownList 112 111 TabOrder = 5 -
branches/generator/Forms/UFormRuleItem.lfm
r129 r131 7 7 ClientHeight = 400 8 8 ClientWidth = 656 9 DesignTimePPI = 12010 9 OnClose = FormClose 11 10 OnCreate = FormCreate 12 11 OnDestroy = FormDestroy 13 12 OnShow = FormShow 14 LCLVersion = '1.8.0. 6'13 LCLVersion = '1.8.0.4' 15 14 object ButtonCancel: TButton 16 15 Left = 176 … … 35 34 object ComboBoxType: TComboBox 36 35 Left = 160 37 Height = 2836 Height = 33 38 37 Top = 16 39 38 Width = 400 40 ItemHeight = 2039 ItemHeight = 0 41 40 Items.Strings = ( 42 41 'Terminal' … … 51 50 object Label2: TLabel 52 51 Left = 16 53 Height = 2 052 Height = 23 54 53 Top = 24 55 Width = 3554 Width = 40 56 55 Caption = 'Type:' 57 56 ParentColor = False … … 62 61 Top = 88 63 62 Width = 632 64 ActivePage = TabSheetTerminal 63 ActivePage = TabSheetTerminalRange 65 64 Anchors = [akTop, akLeft, akRight, akBottom] 66 65 ShowTabs = False 67 TabIndex = 066 TabIndex = 3 68 67 TabOrder = 3 69 68 object TabSheetTerminal: TTabSheet 70 69 Caption = 'Terminal' 71 ClientHeight = 2 5872 ClientWidth = 62 470 ClientHeight = 260 71 ClientWidth = 626 73 72 object EditTerminal: TEdit 74 73 Left = 152 75 Height = 2874 Height = 33 76 75 Top = 16 77 76 Width = 400 … … 81 80 object LabelTerminal: TLabel 82 81 Left = 8 83 Height = 2 082 Height = 23 84 83 Top = 16 85 Width = 6184 Width = 70 86 85 Caption = 'Terminal:' 87 86 ParentColor = False … … 90 89 object TabSheetNonTerminal: TTabSheet 91 90 Caption = 'NonTerminal' 92 ClientHeight = 2 5893 ClientWidth = 62 491 ClientHeight = 260 92 ClientWidth = 626 94 93 object LabelNonTerminal: TLabel 95 94 Left = 8 … … 107 106 Anchors = [akTop, akLeft, akRight, akBottom] 108 107 ItemHeight = 0 108 ScrollWidth = 482 109 109 TabOrder = 0 110 TopIndex = -1 110 111 end 111 112 end … … 114 115 end 115 116 object TabSheetTerminalRange: TTabSheet 116 Caption = 'T abSheetTerminalRange'117 ClientHeight = 2 58118 ClientWidth = 62 4117 Caption = 'Terminal range' 118 ClientHeight = 260 119 ClientWidth = 626 119 120 object LabelTerminal1: TLabel 120 121 Left = 8 121 Height = 2 0122 Height = 23 122 123 Top = 16 123 Width = 97124 Width = 112 124 125 Caption = 'Terminal from:' 125 126 ParentColor = False … … 127 128 object EditTerminalFrom: TEdit 128 129 Left = 152 129 Height = 28130 Height = 33 130 131 Top = 16 131 132 Width = 400 … … 135 136 object LabelTerminal2: TLabel 136 137 Left = 8 137 Height = 2 0138 Height = 23 138 139 Top = 56 139 Width = 79140 Width = 90 140 141 Caption = 'Terminal to:' 141 142 ParentColor = False … … 143 144 object EditTerminalTo: TEdit 144 145 Left = 152 145 Height = 28146 Height = 33 146 147 Top = 56 147 148 Width = 400 … … 153 154 object CheckBoxOptional: TCheckBox 154 155 Left = 16 155 Height = 2 4156 Height = 27 156 157 Top = 56 157 Width = 82158 Width = 90 158 159 Caption = 'Optional' 159 160 TabOrder = 4 … … 161 162 object CheckBoxRepetitive: TCheckBox 162 163 Left = 216 163 Height = 2 4164 Height = 27 164 165 Top = 56 165 Width = 9 1166 Width = 99 166 167 Caption = 'Repetitive' 167 168 TabOrder = 5 … … 169 170 object CheckBoxAnyExcept: TCheckBox 170 171 Left = 400 171 Height = 2 4172 Height = 27 172 173 Top = 56 173 Width = 97174 Width = 106 174 175 Caption = 'Any except' 175 176 TabOrder = 6 -
branches/generator/Languages
-
Property svn:ignore
set to
*.mo
-
Property svn:ignore
set to
-
branches/generator/Languages/generator.cs.po
r130 r131 10 10 "Content-Transfer-Encoding: 8bit\n" 11 11 "Language: cs\n" 12 "X-Generator: Poedit 1.8.8\n"12 "X-Generator: Poedit 2.0.4\n" 13 13 14 14 #: tformgrammer.buttoncancel.caption 15 15 msgctxt "tformgrammer.buttoncancel.caption" 16 16 msgid "Cancel" 17 msgstr " "17 msgstr "ZruÅ¡it" 18 18 19 19 #: tformgrammer.buttonok.caption 20 20 msgid "OK" 21 msgstr " "21 msgstr "OK" 22 22 23 23 #: tformgrammer.caption 24 24 msgid "Grammer settings" 25 msgstr " "25 msgstr "Nastavenà gramatiky" 26 26 27 27 #: tformgrammer.label1.caption 28 28 msgid "Start rule:" 29 msgstr " "29 msgstr "PoÄáteÄnà pravidlo:" 30 30 31 31 #: tformmain.abuildcompiler.caption … … 65 65 msgstr "OtevÅÃt..." 66 66 67 #: tformmain.aprojectopenrecent.caption 68 msgctxt "tformmain.aprojectopenrecent.caption" 69 msgid "Open recent" 70 msgstr "OtevÅÃt nedávnÃœ" 71 67 72 #: tformmain.aprojectsave.caption 68 73 msgid "Save" … … 89 94 msgstr "Pravidla" 90 95 96 #: tformmain.atoolbarvisible.caption 97 msgctxt "tformmain.atoolbarvisible.caption" 98 msgid "Toolbar" 99 msgstr "NástrojovÃœ panel" 100 91 101 #: tformmain.caption 92 102 msgid "Language generator" … … 105 115 msgstr "Nástroje" 106 116 117 #: tformmain.menuitemrecent.caption 118 msgctxt "tformmain.menuitemrecent.caption" 119 msgid "Open recent" 120 msgstr "OtevÅÃt nedávnÃœ" 121 107 122 #: tformmain.tabsheetbnf.caption 108 123 msgid "BNF" 109 msgstr " "124 msgstr "BNF" 110 125 111 126 #: tformmain.tabsheetebnf.caption 112 127 msgid "EBNF" 113 msgstr " "128 msgstr "EBNF" 114 129 115 130 #: tformmain.tabsheetrules.caption 116 #, fuzzy117 131 msgctxt "tformmain.tabsheetrules.caption" 118 132 msgid "Rules" … … 122 136 msgctxt "tformrule.buttoncancel.caption" 123 137 msgid "Cancel" 124 msgstr " "138 msgstr "ZruÅ¡it" 125 139 126 140 #: tformrule.buttonok.caption 127 141 msgctxt "tformrule.buttonok.caption" 128 142 msgid "Ok" 129 msgstr " "143 msgstr "Ok" 130 144 131 145 #: tformrule.caption 132 146 msgid "Rule" 133 msgstr " "147 msgstr "Pravidlo" 134 148 135 149 #: tformrule.checkboxcreatenode.caption 136 150 msgid "Create source node" 137 msgstr " "151 msgstr "VytváÅet zdrojovÃœ uzel" 138 152 139 153 #: tformrule.label1.caption 140 154 msgid "Name:" 141 msgstr " "155 msgstr "Jméno:" 142 156 143 157 #: tformrule.label2.caption 144 msgid "L avel:"145 msgstr " "158 msgid "Level:" 159 msgstr "ÃroveÅ:" 146 160 147 161 #: tformrule.listview1.columns[0].caption 148 #, fuzzy149 162 msgctxt "tformrule.listview1.columns[0].caption" 150 163 msgid "Name" … … 152 165 153 166 #: tformrule.tabsheet1.caption 154 #, fuzzy155 167 msgctxt "tformrule.tabsheet1.caption" 156 168 msgid "Items" … … 159 171 #: tformrule.tabsheet2.caption 160 172 msgid "Links" 161 msgstr " "173 msgstr "Vazby" 162 174 163 175 #: tformrule.tabsheetusedby.caption 164 176 msgid "Used by" 165 msgstr " "177 msgstr "PouÅŸita ÄÃm" 166 178 167 179 #: tformruleitem.buttoncancel.caption 168 180 msgctxt "tformruleitem.buttoncancel.caption" 169 181 msgid "Cancel" 170 msgstr " "182 msgstr "ZruÅ¡it" 171 183 172 184 #: tformruleitem.buttonok.caption 173 185 msgctxt "tformruleitem.buttonok.caption" 174 186 msgid "Ok" 175 msgstr " "187 msgstr "Ok" 176 188 177 189 #: tformruleitem.caption 178 190 msgid "Rule item" 179 msgstr " "191 msgstr "PoloÅŸka pravidla" 180 192 181 193 #: tformruleitem.checkboxanyexcept.caption 182 194 msgid "Any except" 183 msgstr " "195 msgstr "VÅ¡e kromÄ" 184 196 185 197 #: tformruleitem.checkboxoptional.caption 186 198 msgid "Optional" 187 msgstr " "199 msgstr "VolitelnÃœ" 188 200 189 201 #: tformruleitem.checkboxrepetitive.caption 190 202 msgid "Repetitive" 191 msgstr " "203 msgstr "OpakovanÃœ" 192 204 193 205 #: tformruleitem.label2.caption 194 206 msgid "Type:" 195 msgstr " "207 msgstr "Typ:" 196 208 197 209 #: tformruleitem.labelnonterminal.caption 198 210 msgid "Non-terminal:" 199 msgstr " "211 msgstr "NekoncovÃœ:" 200 212 201 213 #: tformruleitem.labelterminal.caption 202 214 msgid "Terminal:" 203 msgstr " "215 msgstr "KoncovÃœ:" 204 216 205 217 #: tformruleitem.labelterminal1.caption 206 218 msgid "Terminal from:" 207 msgstr " "219 msgstr "KoncovÃœ od:" 208 220 209 221 #: tformruleitem.labelterminal2.caption 210 222 msgid "Terminal to:" 211 msgstr " "223 msgstr "KoncovÃœ do:" 212 224 213 225 #: tformruleitem.tabsheetnonterminal.caption 214 226 msgid "NonTerminal" 215 msgstr " "227 msgstr "NekoncovÃœ" 216 228 217 229 #: tformruleitem.tabsheetsubitems.caption 218 230 msgid "SubItems" 219 msgstr " "231 msgstr "PodpoloÅŸky" 220 232 221 233 #: tformruleitem.tabsheetterminal.caption 222 234 msgid "Terminal" 223 msgstr " "235 msgstr "KoncovÃœ" 224 236 225 237 #: tformruleitem.tabsheetterminalrange.caption 226 msgid "T abSheetTerminalRange"227 msgstr " "238 msgid "Terminal range" 239 msgstr "NekoncovÃœ rozsah" 228 240 229 241 #: tformruleitems.aadd.caption … … 318 330 #: tformrules.listview1.columns[4].caption 319 331 msgid "Level" 320 msgstr " "332 msgstr "ÃroveÅ" 321 333 322 334 #: uformmain.sdoyouwanttosaveproject … … 331 343 msgid "Unsaved changes" 332 344 msgstr "NeuloÅŸené zmÄny" 333 -
branches/generator/Languages/generator.po
r130 r131 55 55 msgstr "" 56 56 57 #: tformmain.aprojectopenrecent.caption 58 msgctxt "tformmain.aprojectopenrecent.caption" 59 msgid "Open recent" 60 msgstr "" 61 57 62 #: tformmain.aprojectsave.caption 58 63 msgid "Save" … … 79 84 msgstr "" 80 85 86 #: tformmain.atoolbarvisible.caption 87 msgctxt "tformmain.atoolbarvisible.caption" 88 msgid "Toolbar" 89 msgstr "" 90 81 91 #: tformmain.caption 82 92 msgid "Language generator" … … 93 103 #: tformmain.menuitem8.caption 94 104 msgid "Tools" 105 msgstr "" 106 107 #: tformmain.menuitemrecent.caption 108 msgctxt "tformmain.menuitemrecent.caption" 109 msgid "Open recent" 95 110 msgstr "" 96 111 … … 131 146 132 147 #: tformrule.label2.caption 133 msgid "L avel:"148 msgid "Level:" 134 149 msgstr "" 135 150 … … 211 226 212 227 #: tformruleitem.tabsheetterminalrange.caption 213 msgid "T abSheetTerminalRange"228 msgid "Terminal range" 214 229 msgstr "" 215 230 -
branches/generator/Packages/Common/ULastOpenedList.pas
r114 r131 6 6 7 7 uses 8 Classes, SysUtils, Registry, URegistry, Menus, XMLConf ;8 Classes, SysUtils, Registry, URegistry, Menus, XMLConf, DOM; 9 9 10 10 type … … 30 30 procedure SaveToXMLConfig(XMLConfig: TXMLConfig; Path: string); 31 31 procedure AddItem(FileName: string); 32 function GetFirstFileName: string; 32 33 published 33 34 property MaxCount: Integer read FMaxCount write SetMaxCount; … … 139 140 OpenKey(Context.Key, True); 140 141 for I := 0 to Items.Count - 1 do 141 WriteString('File' + IntToStr(I), UTF8Decode(Items[I]));142 WriteString('File' + IntToStr(I), Items[I]); 142 143 finally 143 144 Free; … … 153 154 begin 154 155 with XMLConfig do begin 155 Count := GetValue( Path + '/Count', 0);156 Count := GetValue(DOMString(Path + '/Count'), 0); 156 157 if Count > MaxCount then Count := MaxCount; 157 158 Items.Clear; 158 159 for I := 0 to Count - 1 do begin 159 Value := GetValue(Path + '/File' + IntToStr(I), '');160 Value := string(GetValue(DOMString(Path + '/File' + IntToStr(I)), '')); 160 161 if Trim(Value) <> '' then Items.Add(Value); 161 162 end; … … 170 171 begin 171 172 with XMLConfig do begin 172 SetValue( Path + '/Count', Items.Count);173 SetValue(DOMString(Path + '/Count'), Items.Count); 173 174 for I := 0 to Items.Count - 1 do 174 SetValue( Path + '/File' + IntToStr(I), Items[I]);175 SetValue(DOMString(Path + '/File' + IntToStr(I)), DOMString(Items[I])); 175 176 Flush; 176 177 end; … … 185 186 end; 186 187 188 function TLastOpenedList.GetFirstFileName: string; 189 begin 190 if Items.Count > 0 then Result := Items[0] 191 else Result := ''; 192 end; 193 187 194 end. 188 195 -
branches/generator/UCore.lfm
r129 r131 5 5 Height = 733 6 6 HorizontalOffset = 491 7 VerticalOffset = 2 977 VerticalOffset = 287 8 8 Width = 1180 9 PPI = 12010 9 object ImageList1: TImageList 11 10 left = 540 -
branches/generator/UCore.pas
r129 r131 6 6 7 7 uses 8 Classes, SysUtils, XMLConf, FileUtil, Controls, ActnList, UGrammer, DOM,9 UPersistentForm ;8 Classes, SysUtils, XMLConf, FileUtil, Controls, ActnList, UGrammer, 9 UPersistentForm, ULastOpenedList; 10 10 11 11 type … … 22 22 { private declarations } 23 23 public 24 LastOpenedFile: string;25 24 ReopenLastFile: Boolean; 26 25 Grammer: TGrammer; … … 28 27 procedure SaveConfig; 29 28 procedure Initialize; 29 procedure Finalize; 30 30 end; 31 31 … … 46 46 ForceDirectories(GetAppConfigDir(False)); 47 47 XMLConfig1.Filename := GetAppConfigDir(False) + 'Config.xml'; 48 LoadConfig;49 48 end; 50 49 51 50 procedure TCore.DataModuleDestroy(Sender: TObject); 52 51 begin 53 SaveConfig;54 52 end; 55 53 … … 57 55 begin 58 56 with XMLConfig1 do begin 59 LastOpenedFile := string(GetValue('LastOpenedFile', 'pascal.grm'));60 57 ReopenLastFile := GetValue('ReopenLastFile', True); 61 58 end; … … 65 62 begin 66 63 with XMLConfig1 do begin 67 SetValue('LastOpenedFile', DOMString(LastOpenedFile));68 64 SetValue('ReopenLastFile', ReopenLastFile); 69 65 Flush; … … 73 69 procedure TCore.Initialize; 74 70 begin 75 FormMain.AProjectNew.Execute; 76 if ReopenLastFile and FileExists(LastOpenedFile) then 77 Grammer.LoadFromXmlFile(LastOpenedFile) 71 LoadConfig; 72 FormMain.LoadConfig(XMLConfig1); 73 if ReopenLastFile and FileExists(FormMain.LastOpenedList1.GetFirstFileName) then 74 FormMain.ProjectOpen(FormMain.LastOpenedList1.GetFirstFileName) 75 else FormMain.AProjectNew.Execute; 76 end; 77 78 procedure TCore.Finalize; 79 begin 80 FormMain.SaveConfig(XMLConfig1); 81 SaveConfig; 78 82 end; 79 83 -
branches/generator/UGrammer.pas
r130 r131 15 15 16 16 TRuleItemType = (ritTerminal, ritNonTerminal, ritSubItems, ritTerminalRange); 17 TGrammerNotation = (gnBnf, gnEbnf); 17 18 18 19 { TRuleItem } … … 39 40 procedure SaveToXmlNode(Node: TDOMNode); 40 41 function GetString: string; 42 function ExportAsString(Notation: TGrammerNotation): string; 41 43 constructor Create; 42 44 destructor Destroy; override; … … 61 63 procedure UpdateRuleReference; 62 64 function GetString: string; 65 function ExportAsString(Notation: TGrammerNotation): string; 63 66 property ParentRule: TRule read FParentRule write SetParentRule; 64 67 end; … … 95 98 procedure SaveToXmlNode(Node: TDOMNode); 96 99 function GetString: string; 100 function ExportAsString(Notation: TGrammerNotation): string; 97 101 property Grammer: TGrammer read FGrammer write SetGrammer; 98 102 end; … … 106 110 procedure SaveToXmlNode(Node: TDOMNode); 107 111 function GetString: string; 112 function ExportAsString(Notation: TGrammerNotation): string; 108 113 end; 109 114 … … 129 134 procedure GetUsedByRule(RefRule: TRule; UsedByRules: TStrings); 130 135 function GetString: string; 136 function ExportAsString(Notation: TGrammerNotation): string; 131 137 procedure Change; 132 138 property Modified: Boolean read FModified write SetModified; … … 248 254 begin 249 255 Result := Rules.GetString; 256 end; 257 258 function TGrammer.ExportAsString(Notation: TGrammerNotation): string; 259 begin 260 Result := Rules.ExportAsString(Notation); 250 261 end; 251 262 … … 292 303 if Repetitive then Result := '*' + Result; 293 304 if AnyExcept then Result := '!' + Result; 305 end; 306 307 function TRuleItem.ExportAsString(Notation: TGrammerNotation): string; 308 begin 309 case Notation of 310 gnBnf: begin 311 case RuleItemType of 312 ritTerminal: Result := Terminal; 313 ritNonTerminal: Result := '<' + NonTerminal.Name + '>'; 314 ritSubItems: begin 315 if not Optional and not Repetitive then 316 Result := '(' + SubItems.ExportAsString(Notation) + ')' 317 else Result := SubItems.ExportAsString(Notation); 318 end; 319 ritTerminalRange: Result := '(' + TerminalFrom + ' .. ' + TerminalTo + ')'; 320 end; 321 if Optional and not Repetitive then Result := '[' + Result + ']'; 322 if Repetitive then Result := '{' + Result + '}'; 323 if AnyExcept then Result := 'other then ' + Result; 324 end; 325 gnEbnf: begin 326 case RuleItemType of 327 ritTerminal: Result := '"' + Terminal + '"'; 328 ritNonTerminal: Result := NonTerminal.Name; 329 ritSubItems: begin 330 if not Optional and not Repetitive then 331 Result := '(' + SubItems.ExportAsString(Notation) + ')' 332 else Result := SubItems.ExportAsString(Notation); 333 end; 334 ritTerminalRange: Result := '(' + TerminalFrom + ' .. ' + TerminalTo + ')'; 335 end; 336 if Optional and not Repetitive then Result := '[' + Result + ']'; 337 if Repetitive then Result := '{' + Result + '}'; 338 if AnyExcept then Result := 'other then ' + Result; 339 end; 340 end; 294 341 end; 295 342 … … 395 442 end; 396 443 444 function TRuleItems.ExportAsString(Notation: TGrammerNotation): string; 445 var 446 Item: TRuleItem; 447 begin 448 Result := ''; 449 for Item in Self do begin 450 if Item <> First then begin 451 if RuleType = rtAnd then begin 452 case Notation of 453 gnBnf: Result := Result + ' '; 454 gnEbnf: Result := Result + ', '; 455 end; 456 end else 457 if RuleType = rtOr then begin 458 case Notation of 459 gnBnf: Result := Result + ' | '; 460 gnEbnf: Result := Result + ' | '; 461 end; 462 end; 463 end; 464 Result := Result + Item.ExportAsString(Notation); 465 end; 466 end; 467 397 468 procedure TRuleItems.SetParentRule(AValue: TRule); 398 469 begin … … 456 527 end; 457 528 529 function TRule.ExportAsString(Notation: TGrammerNotation): string; 530 begin 531 case Notation of 532 gnBnf: Result := Name + ' ::= ' + Items.ExportAsString(Notation); 533 gnEbnf: Result := Name + ' = ' + Items.ExportAsString(Notation); 534 end; 535 end; 536 458 537 procedure TRule.SetGrammer(AValue: TGrammer); 459 538 begin … … 553 632 end; 554 633 634 function TRules.ExportAsString(Notation: TGrammerNotation): string; 635 var 636 Rule: TRule; 637 begin 638 Result := ''; 639 for Rule in Self do begin 640 Result := Result + Rule.ExportAsString(Notation) + LineEnding; 641 end; 642 end; 643 555 644 end. 556 645
Note:
See TracChangeset
for help on using the changeset viewer.