G
GregHiggins
Guest
/*------------------------------------------------------------------------ File : OverParser Purpose : Syntax : Description : Author(s) : Created : Fri Apr 20 10:01:48 EDT 2018 Notes : Just for kicks ----------------------------------------------------------------------*/ using Progress.Lang.*. using Progress.Json.ObjectModel.*. block-level on error undo, throw. class OverParser inherits ObjectModelParser use-widget-pool: /*------------------------------------------------------------------------------ Purpose: Notes: ------------------------------------------------------------------------------*/ define protected variable myParser as ObjectModelParser no-undo. method public logical isJsony ( source as character ): define variable result as logical no-undo. define variable tSource as character no-undo. define variable startChar as character no-undo. define variable endChar as character no-undo. define variable wSize as integer no-undo. assign tSource = trim ( source ) wSize = length ( tSource, "character":u ) . if wSize gt 0 then do: assign startChar = substring ( tSource, 1, 1 ) endChar = substring ( tSource, wSize, 1 ) . assign result = false result = ( startChar eq endChar ) when index ( startChar, "~{[":u ) gt 0 . end. finally: return result. end finally. end. method public JsonConstruct OverParse ( source as longchar ): define variable result as JsonCOnstruct no-undo. assign result = myParser
arse ( source ) . return result. end method /* OverParse */. method public JsonConstruct OverParse ( source as memptr ): define variable result as JsonCOnstruct no-undo. assign result = myParser
arse ( source ) . return result. end method /* OverParse */. method public JsonConstruct OverParse ( source as handle ): define variable result as JsonCOnstruct no-undo. assign result = myParser
arse ( source ) . return result. end method /* OverParse */. method public JsonConstruct OverParse ( source as character ): define variable result as JsonConstruct no-undo. define variable lc as longchar no-undo. fix-codepage ( lc ) = "utf-8". if isJsony ( source ) then do: assign result = myParser
arse ( source ) . end. else do: assign file-info
athname = source . if file-info:full-pathname gt "" then do: copy-lob from file file-info:full-pathname to lc. assign result = myParser
arse ( lc ) . end. else result = ?. end. return result. end method /* OverParse */. constructor public OverParser ( ): super (). assign myParser = new ObjectModelParser ( ) . end constructor. end class /* OverParser */.
Continue reading...
Continue reading...