Jump to content

Leaderboard


Popular Content

Showing content with the highest reputation on 11/19/18 in all areas

  1. 2 points
    until
    https://conf.spring4d.com/
  2. Fritzew

    Graphics32

    I have checked my Source, it is from Sourceforge http://svn.code.sf.net/p/graphics32/code/trunk I have done 2 Steps to compile it for Tokio 1. Copy of package Dir XE8 do Tokio 2. in the GR32_Compiler.inc added: {$IFDEF VER320} {$DEFINE COMPILERXE8} {$IFNDEF BCB} {$DEFINE DELPHIXE8} {$ELSE} {$DEFINE BCBXE8} {$ENDIF} {$ENDIF} Compile the two Packages GR32_Rxxxx and GR32_Dxxxx Done
  3. Andrea Magni

    Web dashboard application

    And here is a fresh new (minimal) example of producing a Bootstrap page from a MARS server. The example includes a simple GET call performed through Ajax call. Link: https://github.com/andrea-magni/MARS/tree/master/Demos/Bootstrap HTH
  4. IMO, as I've requested before - EMBT really need to consider ARM64 and VCL for RAD Studio. https://www.neowin.net/news/microsoft-is-now-accepting-arm64-apps-in-its-windows-10-store
  5. TStreamReader.Create (fileName) passes the flags as: fmOpenRead or fmShareDenyWrite Sadly, none of the overloads allow you to change this. Worse still: its counterpart TStreamWriter.Create can fail on platforms other than iOS because the flags don't include fmShareDenyWrite
  6. Kryvich

    I'm looking for these menus in the IDE

    It's hard to find a good short shortcuts in IDE that are still free. I found Ctrl-Shift-NumPad- / NumPad+, and made a new plugin for Delphi. You can download it from GitHub and compile for Berlin. https://github.com/Kryuski/Editor-Shortcuts
  7. What you want is called a "Lexer" or "Parser" (depends on whether or not it is persistent), and should not be hard to get actually. Below you find one that I just wrote myself, feel free to use/modify/delete/eat/drink it or do whatever you want with it if it helps you (untested!). unit Lexer; interface uses System.SysUtils, System.Types, System.Generics.Collections; type TLexer = class abstract public type ETokenError = class(Exception); TToken = record private FText: String; FPosition: TPoint; FKind: Byte; public property Text: String read FText; property Position: TPoint read FPosition; property Kind: Byte read FKind; end; private FTokens: TList<TToken>; function GetTokenCount: Integer; function GetTokens(const AIndex: Integer): TToken; protected // Check if end of text is reached function EndsText(const AChar: PChar): Boolean; virtual; // Check if end of line is reached function BreaksLine(const AChar: PChar): Boolean; virtual; // Check if Char is valid (abort if not) function IsValidChar(const AChar: Char; const AKind: Byte): Boolean; virtual; // Get kind of new token function TokenKind(var AChar: PChar): Byte; virtual; abstract; // Check if token ends here function EndsToken(var AChar: PChar; const AKind: Byte): Boolean; virtual; abstract; // Convert token kind if necessary procedure ConvertToken(var AChar: PChar; var AKind: Byte); virtual; abstract; public property Tokens[const AIndex: Integer]: TToken read GetTokens; property TokenCount: Integer read GetTokenCount; constructor Create(const AText: String); destructor Destroy; override; end; implementation { TLexer } function TLexer.BreaksLine(const AChar: PChar): Boolean; begin Result := String.Create([AChar[0], AChar[1]]).Equals(sLineBreak); end; constructor TLexer.Create(const AText: String); procedure Parse; var Current: PChar; Previous: PChar; Token: TToken; Kind: Byte; Position: TPoint; StringBuilder: TStringBuilder; begin Position := Default(TPoint); Current := PChar(AText); StringBuilder := TStringBuilder.Create; try while not EndsText(Current) do begin Previous := Current; Kind := TokenKind(Current); while not (EndsText(Current) or EndsToken(Current, Kind)) do begin if not IsValidChar(Current[0], Kind) then begin raise ETokenError.CreateFmt('Invalid character: ', [String.Create([Current[0]]).QuotedString]); end; ConvertToken(Current, Kind); if BreaksLine(Current) then begin Inc(Position.Y); end; StringBuilder.Append(Current); Inc(Current); end; Token.FText := StringBuilder.ToString; Token.FKind := Kind; Inc(Position.X, (Current - Previous) div SizeOf(Char)); Token.FPosition := Position; StringBuilder.Clear; FTokens.Add(Token); end; finally StringBuilder.Free; end; end; begin inherited Create; FTokens := TList<TToken>.Create; Parse; end; destructor TLexer.Destroy; begin FTokens.Free; inherited; end; function TLexer.EndsText(const AChar: PChar): Boolean; begin Result := AChar[0] = #0; end; function TLexer.GetTokenCount: Integer; begin Result := FTokens.Count; end; function TLexer.GetTokens(const AIndex: Integer): TToken; begin Result := FTokens[AIndex]; end; function TLexer.IsValidChar(const AChar: Char; const AKind: Byte): Boolean; begin Result := CharInSet(AChar, [Low(AnsiChar) .. High(AnsiChar)]); end; end. Note however, that this is not optimal performance-wise.
  8. Yaron

    User contributed samples

    I created the repository here: https://github.com/bLightZP/marsGameServices
  9. I have similar behavior with Shift Ctrl T (add to-do item) if the project is set to auto load (autosave Project Desktop) and CN Pack (and some other add-ins) is installed. The to-do dialog is displayed but the to do item is not added to the editor unless I first right click to display the context menu. I'm not sure it's in any way related.
  10. Look at https://gitlab.com/teo-tsirpanis/gold-parser-Lazarus for a version 5 compatible Gold engine. Version 5 grammars are not compatible with versions 1 engines. But IMHO the good old lex/yacc https://github.com/RomanYankovsky/ndyacclex can be more easily integrated with your Delphi projects. No need to rely on third party libraries. One could develop and test the grammar with GOLD I suppose and then translate it to lex/yacc.
  11. @Uwe Raabe I read a little about this parser, great tool! There is a ready-to-use grammar for Delphi, though without the support of new language features, such as generics, anonymous functions and closures. And there is several GOLD Parser Engines with sources written in Delphi. I took the most recent version and updated it a bit, now it can be compiled in Delphi 10.2.3. Put it on GitHub.
×