You've already forked lazarus-ccr
+ c compiler specific syntax parsing added.
+ GNU CC __attribute__ (...) support * fixed custom entities parsing git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@662 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
@ -2676,6 +2676,11 @@ var
|
||||
proc : TCustomEntityProc;
|
||||
index : Integer;
|
||||
begin
|
||||
if not Assigned(CustomList) then begin
|
||||
Result := nil;
|
||||
Exit;
|
||||
end;
|
||||
|
||||
index := Parser.TokenPos;
|
||||
for i := 0 to CustomList.Count - 1 do begin
|
||||
proc := TCustomEntityProc(CustomList[i]);
|
||||
|
70
bindings/pascocoa/parser/gnuccFeatures.pas
Normal file
70
bindings/pascocoa/parser/gnuccFeatures.pas
Normal file
@ -0,0 +1,70 @@
|
||||
{ * This file is part of ObjCParser tool
|
||||
* Copyright (C) 2008-2009 by Dmitry Boyarintsev under the GNU LGPL
|
||||
* license version 2.0 or 2.1. You should have received a copy of the
|
||||
* LGPL license along with at http://www.gnu.org/
|
||||
}
|
||||
|
||||
unit gnuccFeatures;
|
||||
|
||||
{list of GNU CC features, that might be found at header files
|
||||
it's extermly possible that these language and precomipler features
|
||||
are not to be compatible with MS C/C++ header files }
|
||||
|
||||
interface
|
||||
|
||||
{$ifdef fpc}{$mode delphi}{$h+}{$endif}
|
||||
|
||||
uses
|
||||
ObjCParserTypes;
|
||||
|
||||
type
|
||||
TAttribute = class(TEntity)
|
||||
protected
|
||||
function DoParse(AParser: TTextParser): Boolean; override;
|
||||
public
|
||||
Expression : AnsiString;
|
||||
end;
|
||||
|
||||
function ParseAttribute(Parent: TEntity; Parser: TTextParser): TEntity;
|
||||
|
||||
implementation
|
||||
|
||||
function ParseAttribute(Parent: TEntity; Parser: TTextParser): TEntity;
|
||||
var
|
||||
attr : TAttribute;
|
||||
begin
|
||||
attr := TAttribute.Create(nil);
|
||||
try
|
||||
if attr.Parse(Parser) then begin
|
||||
Parent.Items.Add(attr);
|
||||
attr.owner := Parent;
|
||||
Result:=attr;
|
||||
end else begin
|
||||
attr.Free;
|
||||
Result := nil;
|
||||
end;
|
||||
finally
|
||||
end;
|
||||
end;
|
||||
|
||||
{ TAttribute }
|
||||
|
||||
function TAttribute.DoParse(AParser: TTextParser): Boolean;
|
||||
var
|
||||
s : string;
|
||||
tt : TTokenType;
|
||||
begin
|
||||
Result := AParser.FindNextToken(s, tt);
|
||||
|
||||
if not Result or (s <> '__attribute__') then begin
|
||||
Result := false;
|
||||
Exit;
|
||||
end;
|
||||
Expression := ParseSeq(AParser, '(', ')');
|
||||
Result := true;
|
||||
end;
|
||||
|
||||
initialization
|
||||
RegisterEntity( @ParseAttribute);
|
||||
|
||||
end.
|
@ -12,7 +12,7 @@
|
||||
</Flags>
|
||||
<MainUnit Value="0"/>
|
||||
<TargetFileExt Value=""/>
|
||||
<ActiveEditorIndexAtStart Value="1"/>
|
||||
<ActiveEditorIndexAtStart Value="3"/>
|
||||
</General>
|
||||
<VersionInfo>
|
||||
<ProjectVersion Value=""/>
|
||||
@ -31,13 +31,13 @@
|
||||
<LaunchingApplication PathPlusParams="/usr/X11R6/bin/xterm -T 'Lazarus Run Output' -e $(LazarusDir)/tools/runwait.sh $(TargetCmdLine)"/>
|
||||
</local>
|
||||
</RunParams>
|
||||
<Units Count="3">
|
||||
<Units Count="4">
|
||||
<Unit0>
|
||||
<Filename Value="objcparser.pas"/>
|
||||
<IsPartOfProject Value="True"/>
|
||||
<UnitName Value="objcparser"/>
|
||||
<CursorPos X="1" Y="3"/>
|
||||
<TopLine Value="1"/>
|
||||
<CursorPos X="29" Y="24"/>
|
||||
<TopLine Value="10"/>
|
||||
<EditorIndex Value="0"/>
|
||||
<UsageCount Value="26"/>
|
||||
<Loaded Value="True"/>
|
||||
@ -45,23 +45,32 @@
|
||||
<Unit1>
|
||||
<Filename Value="ObjCParserUtils.pas"/>
|
||||
<UnitName Value="ObjCParserUtils"/>
|
||||
<CursorPos X="1" Y="6"/>
|
||||
<CursorPos X="5" Y="9"/>
|
||||
<TopLine Value="1"/>
|
||||
<EditorIndex Value="1"/>
|
||||
<EditorIndex Value="2"/>
|
||||
<UsageCount Value="13"/>
|
||||
<Loaded Value="True"/>
|
||||
</Unit1>
|
||||
<Unit2>
|
||||
<Filename Value="ObjCParserTypes.pas"/>
|
||||
<UnitName Value="ObjCParserTypes"/>
|
||||
<CursorPos X="1" Y="6"/>
|
||||
<TopLine Value="1"/>
|
||||
<EditorIndex Value="2"/>
|
||||
<CursorPos X="10" Y="513"/>
|
||||
<TopLine Value="503"/>
|
||||
<EditorIndex Value="3"/>
|
||||
<UsageCount Value="13"/>
|
||||
<Loaded Value="True"/>
|
||||
</Unit2>
|
||||
<Unit3>
|
||||
<Filename Value="gnuccFeatures.pas"/>
|
||||
<UnitName Value="gnuccFeatures"/>
|
||||
<CursorPos X="1" Y="11"/>
|
||||
<TopLine Value="11"/>
|
||||
<EditorIndex Value="1"/>
|
||||
<UsageCount Value="10"/>
|
||||
<Loaded Value="True"/>
|
||||
</Unit3>
|
||||
</Units>
|
||||
<JumpHistory Count="16" HistoryIndex="15">
|
||||
<JumpHistory Count="18" HistoryIndex="17">
|
||||
<Position1>
|
||||
<Filename Value="objcparser.pas"/>
|
||||
<Caret Line="342" Column="61" TopLine="325"/>
|
||||
@ -126,6 +135,14 @@
|
||||
<Filename Value="ObjCParserTypes.pas"/>
|
||||
<Caret Line="5" Column="18" TopLine="1"/>
|
||||
</Position16>
|
||||
<Position17>
|
||||
<Filename Value="ObjCParserTypes.pas"/>
|
||||
<Caret Line="16" Column="1" TopLine="11"/>
|
||||
</Position17>
|
||||
<Position18>
|
||||
<Filename Value="ObjCParserTypes.pas"/>
|
||||
<Caret Line="117" Column="29" TopLine="107"/>
|
||||
</Position18>
|
||||
</JumpHistory>
|
||||
</ProjectOptions>
|
||||
<CompilerOptions>
|
||||
|
@ -21,7 +21,7 @@ uses
|
||||
SysUtils,
|
||||
ObjCParserUtils,
|
||||
ObjCParserTypes,
|
||||
CToPasWriter;
|
||||
CToPasWriter, gnuccFeatures;
|
||||
|
||||
type
|
||||
// this object is used only for precomile directives handling
|
||||
|
Reference in New Issue
Block a user